Docker cheatsheet
2017-05-04 本文已影响0人
n5ken
From: https://docs.docker.com
Build an image:
$ docker build -t [image-name] [path]
Run an image:
$ docker run [image-name]
Show all images:
$ docker images
Run an image with port mapping, mapping machine’s port 4000 to the container’s EXPOSEd port 80 using -p:
# docker run -p [dest]:[source] [image-name]
$ docker run -p 4000:80 friendlyhello
Adding -d to run in background:
$ docker run -d -p 4000:80 friendlyhello
Show all running container processes:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED
1fa4ab2cf395 friendlyhello "python app.py" 28 seconds ago
Stop a container process:
$ docker stop [process id]