-
Notifications
You must be signed in to change notification settings - Fork 0
Docker
alex [dot] kramer [at] g_m_a_i_l [dot] com edited this page Jun 27, 2018
·
15 revisions
Build image from Dockerfile, skip cache, with name and tag:
docker build --no-cache -t [NAME]:[TAG] [PATH TO DOCKERFILE]Pull image from Docker Hub:
docker pull [REMOTE IMAGE NAME]List all local images:
docker imagesInspect:
docker inspect [IMAGE NAME|ID]History:
docker history [IMAGE NAME|ID]Delete:
docker rmi [IMAGE NAME|ID]Create container from image and start it backgrounded with mapped port (necessary for OSX) and mounted directory:
docker run -d -p [HOST PORT]:[CONTAINER PORT] --mount type=bind,source=[HOST DIR PATH],target=[CONTAINER DIR PATH] [IMAGE NAME|ID]List containers:
docker ps -a # all containers
docker ps --format "{{.Names}}" # running containers by name
docker ps -q # running containers by idBash shell for a running container:
docker exec -it [CONTAINER NAME|ID] bashStart/stop/tail container:
docker start -a [CONTAINER NAME|ID] # attach to stdout
docker stop [CONTAINER NAME|ID]
docker attach [CONTAINER NAME|ID] # attach to stdout of already running containerDelete:
docker rm [CONTAINER NAME|ID]