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
The `ENV key value` form can be ambiguous, for example, the following defines
a single env-variable (`ONE`) with value `"TWO= THREE=world"`:
ENV ONE TWO= THREE=world
While we cannot deprecate/remove that syntax (as it would break existing
Dockerfiles), we should reduce exposure of the format in our examples.
Also updating some code-blocks that were missing language-hints
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
4. Run the [docker-compose up](reference/up.md) command from the top level directory for your project.
173
-
174
-
```none
175
-
$ docker-compose up
176
-
djangosample_db_1 is up-to-date
177
-
Creating djangosample_web_1 ...
178
-
Creating djangosample_web_1 ... done
179
-
Attaching to djangosample_db_1, djangosample_web_1
180
-
db_1 | The files belonging to this database system will be owned by user "postgres".
181
-
db_1 | This user must also own the server process.
182
-
db_1 |
183
-
db_1 | The database cluster will be initialized with locale "en_US.utf8".
184
-
db_1 | The default database encoding has accordingly been set to "UTF8".
185
-
db_1 | The default text search configuration will be set to "english".
186
-
187
-
. . .
188
-
189
-
web_1 | July 30, 2020 - 18:35:38
190
-
web_1 | Django version 3.0.8, using settings 'composeexample.settings'
191
-
web_1 | Starting development server at http://0.0.0.0:8000/
192
-
web_1 | Quit the server with CONTROL-C.
193
-
```
194
-
195
-
At this point, your Django app should be running at port `8000` on
196
-
your Docker host. On Docker Desktop for Mac and Docker Desktop for Windows, go
197
-
to `http://localhost:8000` on a web browser to see the Django
198
-
welcome page. If you are using [Docker Machine](../machine/overview.md),
199
-
then `docker-machine ip MACHINE_VM` returns the Docker host IP
200
-
address, to which you can append the port (`<Docker-Host-IP>:8000`).
201
-
202
-

203
-
204
-
> Note:
205
-
>
206
-
> On certain platforms (Windows 10), you might need to
207
-
edit `ALLOWED_HOSTS` inside `settings.py` and add your Docker host name
208
-
or IP address to the list. For demo purposes, you can set the value to:
209
-
>
210
-
> ALLOWED_HOSTS = ['*']
211
-
>
212
-
> This value is **not** safe for production usage. Refer to the
213
-
[Django documentation](https://docs.djangoproject.com/en/1.11/ref/settings/#allowed-hosts) for more information.
214
-
215
-
5. List running containers.
216
-
217
-
In another terminal window, list the running Docker processes with the `docker container ls` command.
218
-
219
-
```none
220
-
$ docker ps
221
-
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
222
-
def85eff5f51 django_web "python3 manage.py..." 10 minutes ago Up 9 minutes 0.0.0.0:8000->8000/tcp django_web_1
223
-
678ce61c79cc postgres "docker-entrypoint..." 20 minutes ago Up 9 minutes 5432/tcp django_db_1
224
-
225
-
```
226
-
227
-
6. Shut down services and clean up by using either of these methods:
184
+
3. Save and close the file.
185
+
186
+
4. Run the [docker-compose up](reference/up.md) command from the top level directory for your project.
187
+
188
+
```console
189
+
$ docker-compose up
190
+
191
+
djangosample_db_1 is up-to-date
192
+
Creating djangosample_web_1 ...
193
+
Creating djangosample_web_1 ... done
194
+
Attaching to djangosample_db_1, djangosample_web_1
195
+
db_1 | The files belonging to this database system will be owned by user "postgres".
196
+
db_1 | This user must also own the server process.
197
+
db_1 |
198
+
db_1 | The database cluster will be initialized with locale "en_US.utf8".
199
+
db_1 | The default database encoding has accordingly been set to "UTF8".
200
+
db_1 | The default text search configuration will be set to "english".
201
+
202
+
. . .
203
+
204
+
web_1 | July 30, 2020 - 18:35:38
205
+
web_1 | Django version 3.0.8, using settings 'composeexample.settings'
206
+
web_1 | Starting development server at http://0.0.0.0:8000/
207
+
web_1 | Quit the server with CONTROL-C.
208
+
```
209
+
210
+
At this point, your Django app should be running at port `8000` on
211
+
your Docker host. On Docker Desktop for Mac and Docker Desktop for Windows, go
212
+
to `http://localhost:8000` on a web browser to see the Django
213
+
welcome page. If you are using [Docker Machine](../machine/overview.md),
214
+
then `docker-machine ip MACHINE_VM` returns the Docker host IP
215
+
address, to which you can append the port (`<Docker-Host-IP>:8000`).
216
+
217
+

218
+
219
+
> Note:
220
+
>
221
+
> On certain platforms (Windows 10), you might need to edit `ALLOWED_HOSTS`
222
+
> inside `settings.py` and add your Docker host name or IP address to the list.
223
+
> For demo purposes, you can set the value to:
224
+
>
225
+
> ALLOWED_HOSTS = ['*']
226
+
>
227
+
> This value is **not** safe for production usage. Refer to the
228
+
> [Django documentation](https://docs.djangoproject.com/en/1.11/ref/settings/#allowed-hosts) for more information.
229
+
230
+
5. List running containers.
231
+
232
+
In another terminal window, list the running Docker processes with the `docker container ls` command.
233
+
234
+
```console
235
+
$ docker ps
236
+
237
+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
238
+
def85eff5f51 django_web "python3 manage.py..." 10 minutes ago Up 9 minutes 0.0.0.0:8000->8000/tcp django_web_1
239
+
678ce61c79cc postgres "docker-entrypoint..." 20 minutes ago Up 9 minutes 5432/tcp django_db_1
240
+
```
241
+
242
+
6. Shut down services and clean up by using either of these methods:
228
243
229
244
* Stop the application by typing `Ctrl-C`
230
245
in the same shell in where you started it:
231
246
232
-
```none
247
+
```console
233
248
Gracefully stopping... (press Ctrl+C again to force)
234
249
Killing test_web_1 ... done
235
250
Killing test_db_1 ... done
236
251
```
237
252
238
253
* Or, for a more elegant shutdown, switch to a different shell, and run [docker-compose down](reference/down.md) from the top level of your Django sample project directory.
0 commit comments