Running the container
Foreground¶
To run the container in the foreground, you can use:
1 2 3 4 | |
| Part | Meaning |
|---|---|
| docker run | The docker command |
| --rm | Remove the container when it stops |
| -it | You can use CTRL-C to exit the container from the command line, and see the start-up trace -i means --interactive Keep STDIN open even if not attached -t means --tty Allocate a pseudo-TTY |
| -p 8080:8080 | Publish to the host's port 8080 from the container's port 8080 |
| -v /my/docker/files/init:/opt/init:ro | Create a mount from: /my/docker/files/init that surfaces at: /opt/init in the container, in read-only mode (ro) |
| -v /my/docker/files/data:/var/lib/postgresql/data | Create a mount from: /my/docker/files/data that surfaces at: /var/lib/postgresql/data in the container |
| --8← "docs/download/docker-image.md" | The image to run |
Background¶
To run the container in the background, you can use:
1 2 3 4 | |
| Part | Meaning |
|---|---|
| -d | --detach Run container in background and print container ID |
You can see it running in docker:
1 | |
And stop it with:
1 | |