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
description: "Running Umbraco on docker locally using docker compose"
2
+
description: Running Umbraco on docker locally using docker compose
3
3
---
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 an SQL Server database in Docker. This setup is designed to be used for local development, and not for production.
7
+
This article shows how to run Umbraco locally in Docker using Docker Compose. You can use either SQL Server or SQLite for development.
8
+
9
+
{% hint style="info" %}
10
+
This setup is intended for local development only. It is not recommended for production environments.
11
+
{% endhint %}
8
12
9
13
## Prerequisites
10
14
11
-
Before you can run Umbraco in Docker, you need to have the following installed:
12
-
* Version 14.3.0 or higher of the Umbraco Templates
15
+
Before you can run Umbraco in Docker, make sure the following are installed:
16
+
17
+
* .NET SDK with Umbraco Templates v14.3.0 or higher
13
18
* Docker Desktop
14
19
15
20
## Installing
16
21
17
-
Installing Umbraco with the Docker file and Docker Compose file is a two-step process.
22
+
To install Umbraco using the provided Dockerfile and Docker Compose setup, follow these steps:
23
+
24
+
### Option 1: Using SQL Server
18
25
19
-
1. Create a folder to hold your project and enter that folder.
26
+
1. Create a folder and navigate into it:
20
27
21
28
```bash
22
29
mkdir MyDockerProject
23
30
cd MyDockerProject
24
31
```
25
-
2. Create your Umbraco project using the Umbraco Templates, and remember to use the `--add-docker` flag to include the Docker files.
26
32
33
+
2. Create a new Umbraco project with Docker support:
27
34
28
-
Conventionally this is named the same as the folder, but it is not a requirement.
29
-
30
-
```bash
35
+
```csharp
31
36
dotnetnewumbraco-nMyDockerProject--add-docker
32
37
```
33
38
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:
39
+
3. Add Docker Compose files:
35
40
36
-
```bash
41
+
```csharp
37
42
dotnetnewumbraco-compose-P"MyDockerProject"
38
43
```
39
44
40
-
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.
45
+
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.
41
46
42
-
The final folder structure looks like this:
47
+
The folder structure should now look like this:
43
48
44
-
* MyDockerProject
45
-
*MyDockerProject
46
-
*Typical project files
47
-
*DockerFile
48
-
*`.dockerignore`
49
-
*`.env`
50
-
*Database
51
-
*DockerFile
52
-
*`healthcheck.sh`
53
-
*`setup.sql`
54
-
*`startup.sh`
55
-
*`docker-compose.yml`
49
+
* MyDockerProject/
50
+
*Database/
51
+
*Dockerfile
52
+
*healthcheck.sh
53
+
*setup.sql
54
+
* startup.sh
55
+
*MyDockerProject/
56
+
*Your project files
57
+
*Dockerfile
58
+
*.dockerignore
59
+
* .env
60
+
* docker-compose.yml
56
61
57
62
The project now includes docker files for both Umbraco and the SQL server database.
58
63
59
64
It also includes additional scripts to launch and configure the database and a `.env` file with the database password.
60
65
61
-
## Running
66
+
4. Run the following command from the root folder (where `docker-compose.yml` is located):
To speed up the build process, add a `.dockerignore` file to exclude unnecessary folders like `.git`, `bin`, and `obj`.
118
+
{% endhint %}
119
+
120
+
4. Build the container:
121
+
122
+
```bash
123
+
docker build -t umbraco-sqlite .
124
+
```
125
+
126
+
5. Run the container:
62
127
63
-
To run the project use the `docker compose up` command in the root of the project files where the `docker-compose.yml` is.
128
+
```bash
129
+
docker run -p 8080:8080 umbraco-sqlite
130
+
```
64
131
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/`.
132
+
6. Access the site at `http://localhost:8080`.
66
133
67
-
###Useful commands
134
+
## Useful Commands
68
135
69
136
There are some useful commands you can use to manage the docker containers:
70
137
71
-
*`docker compose down --volumes`: Delete your containers and the volumes they use. This is useful if you want to start from scratch.
138
+
*`docker compose down --volumes`: Deletes containers and the volumes they use. This is useful if you want to start from scratch.
72
139
73
140
{% hint style="warning" %}
74
141
Be careful with this command, as it deletes your database and all data in it.
@@ -77,7 +144,7 @@ Be careful with this command, as it deletes your database and all data in it.
77
144
*`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
145
*`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.
79
146
80
-
## Details
147
+
## Bind Mounts (SQL Server setup)
81
148
82
149
The docker compose file uses bind mounts for the following folders:
83
150
@@ -91,10 +158,10 @@ This is not meant to be used in production.
91
158
92
159
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.
93
160
94
-
## Template options
161
+
## Template Options (SQL Server only)
95
162
96
-
The `umbraco-compose` template has a few options that can be used to customize the setup:
163
+
The `umbraco-compose` template supports:
97
164
98
165
*`-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`.
166
+
*`-dbpw` or `--DatabasePassword`: Used to specify the database password. This is stored in the `.env` file and defaults to: `Password1234`.
100
167
*`-p` or `--Port`: Used to specify the port the site will run on. Defaults to `44372`.
description: "Running Umbraco on docker locally using docker compose"
2
+
description: Running Umbraco on docker locally using docker compose
3
3
---
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 an SQL Server database in Docker. This setup is designed to be used for local development, and not for production.
7
+
This article shows how to run Umbraco locally in Docker using Docker Compose. You can use either SQL Server or SQLite for development.
8
+
9
+
{% hint style="info" %}
10
+
This setup is intended for local development only. It is not recommended for production environments.
11
+
{% endhint %}
8
12
9
13
## Prerequisites
10
14
11
-
Before you can run Umbraco in Docker, you need to have the following installed:
12
-
* Version 14.3.0 or higher of the Umbraco Templates
15
+
Before you can run Umbraco in Docker, make sure the following are installed:
16
+
17
+
* .NET SDK with Umbraco Templates v16 or higher
13
18
* Docker Desktop
14
19
15
20
## Installing
16
21
17
-
Installing Umbraco with the Docker file and Docker Compose file is a two-step process.
22
+
To install Umbraco using the provided Dockerfile and Docker Compose setup, follow these steps:
23
+
24
+
### Option 1: Using SQL Server
18
25
19
-
1. Create a folder to hold your project and enter that folder.
26
+
1. Create a folder and navigate into it:
20
27
21
28
```bash
22
29
mkdir MyDockerProject
23
30
cd MyDockerProject
24
31
```
25
-
2. Create your Umbraco project using the Umbraco Templates, and remember to use the `--add-docker` flag to include the Docker files.
26
32
33
+
2. Create a new Umbraco project with Docker support:
27
34
28
-
Conventionally this is named the same as the folder, but it is not a requirement.
29
-
30
-
```bash
35
+
```csharp
31
36
dotnetnewumbraco-nMyDockerProject--add-docker
32
37
```
33
38
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:
39
+
3. Add Docker Compose files:
35
40
36
-
```bash
41
+
```csharp
37
42
dotnetnewumbraco-compose-P"MyDockerProject"
38
43
```
39
44
40
-
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.
45
+
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.
41
46
42
-
The final folder structure looks like this:
47
+
The folder structure should now look like this:
43
48
44
-
* MyDockerProject
45
-
*MyDockerProject
46
-
*Typical project files
47
-
*DockerFile
48
-
*`.dockerignore`
49
-
*`.env`
50
-
*Database
51
-
*DockerFile
52
-
*`healthcheck.sh`
53
-
*`setup.sql`
54
-
*`startup.sh`
55
-
*`docker-compose.yml`
49
+
* MyDockerProject/
50
+
*Database/
51
+
*Dockerfile
52
+
*healthcheck.sh
53
+
*setup.sql
54
+
* startup.sh
55
+
*MyDockerProject/
56
+
*Your project files
57
+
*Dockerfile
58
+
*.dockerignore
59
+
* .env
60
+
* docker-compose.yml
56
61
57
62
The project now includes docker files for both Umbraco and the SQL server database.
58
63
59
64
It also includes additional scripts to launch and configure the database and a `.env` file with the database password.
60
65
61
-
## Running
66
+
4. Run the following command from the root folder (where `docker-compose.yml` is located):
To speed up the build process, add a `.dockerignore` file to exclude unnecessary folders like `.git`, `bin`, and `obj`.
118
+
{% endhint %}
119
+
120
+
4. Build the container:
121
+
122
+
```bash
123
+
docker build -t umbraco-sqlite .
124
+
```
125
+
126
+
5. Run the container:
62
127
63
-
To run the project use the `docker compose up` command in the root of the project files where the `docker-compose.yml` is.
128
+
```bash
129
+
docker run -p 8080:8080 umbraco-sqlite
130
+
```
64
131
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/`.
132
+
6. Access the site at `http://localhost:8080`.
66
133
67
-
###Useful commands
134
+
## Useful Commands
68
135
69
136
There are some useful commands you can use to manage the docker containers:
70
137
71
-
*`docker compose down --volumes`: Delete your containers and the volumes they use. This is useful if you want to start from scratch.
138
+
*`docker compose down --volumes`: Deletes containers and the volumes they use. This is useful if you want to start from scratch.
72
139
73
140
{% hint style="warning" %}
74
141
Be careful with this command, as it deletes your database and all data in it.
@@ -77,7 +144,7 @@ Be careful with this command, as it deletes your database and all data in it.
77
144
*`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
145
*`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.
79
146
80
-
## Details
147
+
## Bind Mounts (SQL Server setup)
81
148
82
149
The docker compose file uses bind mounts for the following folders:
83
150
@@ -91,9 +158,9 @@ This is not meant to be used in production.
91
158
92
159
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.
93
160
94
-
## Template options
161
+
## Template Options (SQL Server only)
95
162
96
-
The `umbraco-compose` template has a few options that can be used to customize the setup:
163
+
The `umbraco-compose` template supports:
97
164
98
165
*`-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
166
*`-dbpw` or `--DatabasePassword`: Used to specify the database password. This is stored in the `.env` file and defaults to: `Password1234`.
0 commit comments