Docker: Difference between revisions
Jump to navigation
Jump to search
m (→Basic commands) |
No edit summary |
||
Line 16: | Line 16: | ||
* docker build -t app-name . | * docker build -t app-name . | ||
= Containers = | |||
* A started container is always associated with a command (either one present on the Docker image by default, or another one given on the command-line with docker run). This is the command that will be restarted with docker restart, or ran again after a docker stop / docker start. |
Revision as of 11:20, 30 November 2021
This is a short tutorial to use Docker.
Basic commands
- List of all containers: docker ps -a
- Remove a container: docker rm <container-id>
- Remove all stopped containers: docker container prune
- List of all images: docker image ls
- Remove an image: docker rmi <image-id>
- Remove all dangling images: docker image prune
- Create a new container (from an image): docker create jatzoo/jrivermc24
- Create and run a new container (from an image): docker run -d --name=jrivermc24--stable --net=host -e VNCPASS=foobar -v /volume1/Public/music:/mnt/media jatzoo/jrivermc24:latest
- Execute a command in a running container: docker exec -it <container-name> /bin/bash
Building an image
- docker build -t app-name .
Containers
- A started container is always associated with a command (either one present on the Docker image by default, or another one given on the command-line with docker run). This is the command that will be restarted with docker restart, or ran again after a docker stop / docker start.