Docker
From neil.tappsville.com
Jump to navigationJump to searchDocker
Containers
List running containers
docker ps
List all containers
docker ps -a
Run a container
docker run [image] -d detached -i interactive -t terminal (usually -it) -e VAR=value (environment variables) --name name run:version (using a tag)
Port mapping
-p (host/external):(container/internal)
Directory mapping
-v /host/dir:/container/dir
Inspect (returns json)
docker inspect [container]
Images
List images
docker image ls
Remove image (must have no containers attached)
docker rmi [image]
Dockerfile
Contains Instructions or Arguments
FROM ubuntu:18.04 COPY . /app RUN make /app CMD python /app/app.py
Build
docker build [path/Dockerfilefolder] -t name:tag