You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 15/umbraco-cms/fundamentals/setup/install/running-umbraco-on-docker-locally.md
+33-30Lines changed: 33 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,7 @@ description: "Running Umbraco on docker locally using docker compose"
4
4
5
5
# Running Umbraco in Docker using Docker Compose
6
6
7
-
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.
8
-
This setup is designed to be used for local development, and not for production.
7
+
To aid in developing Umbraco with additional services, the templates can provide the requisite files to run Umbraco with an SQL Server database in Docker. This setup is designed to be used for local development, and not for production.
9
8
10
9
## Prerequisites
11
10
@@ -17,20 +16,22 @@ Before you can run Umbraco in Docker, you need to have the following installed:
17
16
18
17
Installing Umbraco with the Docker file and Docker Compose file is a two-step process.
19
18
20
-
First, create a folder to hold your project and enter that folder.
19
+
1. Create a folder to hold your project and enter that folder.
21
20
22
21
```bash
23
22
mkdir MyDockerProject
24
23
cd MyDockerProject
25
24
```
26
-
Next create your Umbraco project using the Umbraco Templates, and remember to use the `--add-docker` flag to include the Docker files.
27
-
Conventionally this is named the same as the folder, but is not a requirement.
25
+
2. Create your Umbraco project using the Umbraco Templates, and remember to use the `--add-docker` flag to include the Docker files.
26
+
27
+
28
+
Conventionally this is named the same as the folder, but it is not a requirement.
28
29
29
30
```bash
30
31
dotnet new umbraco -n MyDockerProject --add-docker
31
32
```
32
33
33
-
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:
34
+
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:
34
35
35
36
```bash
36
37
dotnet new umbraco-compose -P "MyDockerProject"
@@ -44,54 +45,56 @@ The final folder structure looks like this:
44
45
* MyDockerProject
45
46
* Typical project files
46
47
* DockerFile
47
-
* .dockerignore
48
-
* .env
48
+
*`.dockerignore`
49
+
*`.env`
49
50
* Database
50
51
* DockerFile
51
-
* healthcheck.sh
52
-
* setup.sql
53
-
* startup.sh
54
-
* docker-compose.yml
52
+
*`healthcheck.sh`
53
+
*`setup.sql`
54
+
*`startup.sh`
55
+
*`docker-compose.yml`
55
56
56
-
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.
57
+
The project now includes docker files for both Umbraco and the SQL server database.
57
58
58
-
It also includes a .env file with the password for the database.
59
+
It also includes additional scripts to launch and configure the database and a `.env` file with the database password.
59
60
60
61
## Running
61
62
62
-
To run the project run the `docker compose up` command from the root of the project, same folder as`docker-compose.yml`.
63
+
To run the project use the `docker compose up` command in the root of the project files where the`docker-compose.yml` is.
63
64
64
-
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/`
65
+
This command will build both the Umbraco and SQL Server images and launch them in the correct order. When the site is booted, access it in your browser on `http://localhost:44372/`.
65
66
66
67
### Useful commands
67
68
68
-
There is some useful commands you can use to manage the docker containers:
69
+
There are some useful commands you can use to manage the docker containers:
69
70
70
-
*`docker compose down --volumes` This will delete your containers and the volumes they use, this is useful if you want to start from scratch.
71
+
*`docker compose down --volumes`: Delete your containers and the volumes they use. This is useful if you want to start from scratch.
71
72
72
73
{% hint style="warning" %}
73
-
This delete your database and all data in it, so be careful with this command.
74
+
Be careful with this command, as it deletes your database and all data in it.
74
75
{% endhint %}
75
76
76
-
*`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.
77
-
*`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.
77
+
*`docker compose up --build`: Rebuild the images and start the containers. This is useful if you have made changes to the project and want to see them reflected on the running site.
78
+
*`docker compose watch`: Start the containers and watch the default models folder. This means that if the project uses a source-code models builder the images are automatically rebuilt and restarts when you change the models.
78
79
79
80
## Details
80
81
81
82
The docker compose file uses bind mounts for the following folders:
82
83
83
-
* /wwwroot/media
84
-
* /wwwroot/scripts
85
-
* /wwwroot/css
86
-
* /Views
87
-
* /models
84
+
*`/wwwroot/media`
85
+
*`/wwwroot/scripts`
86
+
*`/wwwroot/css`
87
+
*`/Views`
88
+
*`/models`
89
+
90
+
This is not meant to be used in production.
88
91
89
-
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.
92
+
For local development, however, this means that the files necessary for development are available from outside the container in your IDE. This allows development even though the project is running in docker.
90
93
91
94
## Template options
92
95
93
96
The `umbraco-compose` template has a few options that can be used to customize the setup:
94
97
95
-
*-P or --project-name: The name of the project, this is required and used to set the correct paths in the docker-compose file.
96
-
* -dbpw or --DatabasePasswor: Used to specify the database password, this is stored in the .env file, defaults to: Password1234
97
-
*-p or --Port: Used to specify the port the site will run on, defaults to 44372
98
+
*`-P` or `--project-name`: The name of the project. This is required and used to set the correct paths in the docker-compose file.
99
+
*`-dbpw` or `--DatabasePasswor`: Used to specify the database password. This is stored in the `.env` file and defaults to: `Password1234`.
100
+
*`-p` or `--Port`: Used to specify the port the site will run on. Defaults to `44372`.
0 commit comments