-
Notifications
You must be signed in to change notification settings - Fork 813
Add docker documentation for V14 and V15 #6588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sofietoft
merged 8 commits into
umbraco:main
from
nikolajlauridsen:docker-documentation
Oct 30, 2024
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
00473eb
Add docker documentation
nikolajlauridsen 65c54dc
fixes
nikolajlauridsen d28fd7f
Apply suggestions from code review
nikolajlauridsen 05a1027
Add suggestion from review
nikolajlauridsen 6c0c24d
Copy changes to V15
nikolajlauridsen 3cb7841
Update SUMMARY.md
sofietoft 737dfcc
Update SUMMARY.md
sofietoft 2389127
Update release-candidate-guide.md
sofietoft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
14/umbraco-cms/fundamentals/setup/install/running-umbraco-on-docker-locally.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| --- | ||
| description: "Running Umbraco on docker locally using docker compose" | ||
| --- | ||
|
|
||
| # Running Umbraco in Docker using Docker Compose | ||
|
|
||
| To aid in developing Umbraco with additional services, the templates can provide the requisite files to run Umbraco with a SQL Server database in Docker. | ||
| This setup is designed to be used for local development, and not for production. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Before you can run Umbraco in Docker, you need to have the following installed: | ||
| * Version 14.3.0 or higher of the Umbraco Templates | ||
| * Docker Desktop | ||
|
|
||
| ## Installing | ||
|
|
||
| Installing Umbraco with the Docker file and Docker Compose file is a two-step process. | ||
|
|
||
| First, create a folder to hold your project and enter that folder. | ||
|
|
||
| ```bash | ||
| mkdir MyDockerProject | ||
| cd MyDockerProject | ||
| ``` | ||
| Next create your Umbraco project using the Umbraco Templates, and remember to use the `--add-docker` flag to include the Docker files. | ||
| Conventionally this is named the same as the folder, but is not a requirement. | ||
|
|
||
| ```bash | ||
| dotnet new umbraco -n MyDockerProject --add-docker | ||
| ``` | ||
|
|
||
| Now we need to add some additional files to make docker compose work. We can do this using the `umbraco-compose` template, passing the project name we specified earlier to the `-P` parameter: | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```bash | ||
| dotnet new umbraco-compose -P "MyDockerProject" | ||
| ``` | ||
|
|
||
| The `-P` flag is required to specify the correct paths in the docker-compose file. The project is now ready to run with docker compose. | ||
|
|
||
| The final folder structure looks like this: | ||
|
|
||
| * MyDockerProject | ||
| * MyDockerProject | ||
| * Typical project files | ||
| * DockerFile | ||
| * .dockerignore | ||
| * .env | ||
| * Database | ||
| * DockerFile | ||
| * healthcheck.sh | ||
|
Check warning on line 51 in 14/umbraco-cms/fundamentals/setup/install/running-umbraco-on-docker-locally.md
|
||
| * setup.sql | ||
|
Check warning on line 52 in 14/umbraco-cms/fundamentals/setup/install/running-umbraco-on-docker-locally.md
|
||
| * startup.sh | ||
| * docker-compose.yml | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| As you can see the project now includes docker files for both Umbraco itself and the SQL server database, as well as some additional scripts to launch and configure the database. | ||
|
|
||
| It also includes a .env file with the password for the database. | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Running | ||
|
|
||
| To run the project run the `docker compose up` command from the root of the project, same folder as `docker-compose.yml`. | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| This command will build both the Umbraco and Sql Server images and launch them in the correct order, after a while the site will have booted and you can navigate to it in your browser like nomral on `http://localhost:44372/` | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Useful commands | ||
|
|
||
| There is some useful commands you can use to manage the docker containers: | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| * `docker compose down --volumes` This will delete your containers and the volumes they use, this is useful if you want to start from scratch. | ||
|
|
||
| {% hint style="warning" %} | ||
| This delete your database and all data in it, so be careful with this command. | ||
| {% endhint %} | ||
|
|
||
| * `docker compose up --build` This will rebuild the images and start the containers, this is useful if you have made changes to the project and want to see them reflected in the running site. | ||
| * `docker compose watch` This will start the containers and watch the default models folder, this means that if the project uses source code models builder the images automatically rebuilds and restarts when you change the models. | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Details | ||
|
|
||
| The docker compose file uses bind mounts for the following folders: | ||
|
|
||
| * /wwwroot/media | ||
| * /wwwroot/scripts | ||
| * /wwwroot/css | ||
| * /Views | ||
| * /models | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| This is bad for production, however, for local development this means that the files necessary for development are available from outside the container in your IDE allowing you to effectively develop even though the project is running in docker. | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Template options | ||
|
|
||
| The `umbraco-compose` template has a few options that can be used to customize the setup: | ||
|
|
||
| * -P or --project-name: The name of the project, this is required and used to set the correct paths in the docker-compose file. | ||
| * -dbpw or --DatabasePasswor: Used to specify the database password, this is stored in the .env file, defaults to: Password1234 | ||
| * -p or --Port: Used to specify the port the site will run on, defaults to 44372 | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.