Skip to content

Commit 66a69a7

Browse files
author
Robert Kleger
committed
extend docker section in readme
1 parent 1646968 commit 66a69a7

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ docker build -t <your-image-name> .
385385
386386
### Run Docker image in container and map port
387387
388+
The port which runs your application inside Docker container is either configured as `PORT` property in your `.env` configuration file or passed to Docker container via environment variable `PORT`. Default port is `3000`.
389+
388390
#### Run image in detached mode
389391
390392
```shell
@@ -415,6 +417,39 @@ docker images
415417
416418
Go to console and press <CTRL> + C at any time.
417419
420+
### Docker environment variables
421+
422+
There are several options to configure your app inside a Docker container
423+
424+
#### project .env file
425+
426+
You can use `.env` file in project root folder which will be copied inside Docker image. If you want to change a property inside `.env` you have to rebuild your Docker image.
427+
428+
#### run options
429+
430+
You can also change app configuration by passing environment variables via `docker run` option `-e` or `--env`.
431+
432+
```shell
433+
docker run --env DB_HOST=localhost -e DB_PORT=3306
434+
```
435+
436+
#### environment file
437+
438+
Last but not least you can pass a config file to `docker run`.
439+
440+
```shell
441+
docker run --env-file ./env.list
442+
```
443+
444+
`env.list` example:
445+
446+
```
447+
# this is a comment
448+
DB_TYPE=mysql
449+
DB_HOST=localhost
450+
DB_PORT=3306
451+
```
452+
418453
## Further Documentations
419454
420455
| Name & Link | Description |

0 commit comments

Comments
 (0)