Docker Quick Start - MRLIVING/Becca GitHub Wiki
Overview
Install docker in Ubuntu
-
register gcloud as a Docker credential helper (GCE only)
gcloud auth configure-docker
Docker commands
-
Search the Docker Hub for images
docker search ubuntu -f -is-official=true
, search official released imageubuntu
from the Docker Hub -
Create a new container and run the command
docker run -it ${Image} /bin/bash
-
Attach to a running container
docker attach ${ContainerID}
-
Execute a command in a running container
# enter into to a container and run in Bash shell docker exec -it ${ContainerID} /bin/bash
-
Exit from a container
crtl + p, q
(keep the container alive)exit
(shutdown the container)
-
List images
docker images
-
List containers and IDs
docker ps -a
-
List containers
docker container ls
-
List networks
docker network ls
-
Display detailed information on one or more networks
docker network inspect ${NETWORK}
-
Stop a container
docker stop ${ContainerID}
-
Start a container
docker start ${ContainerID}
-
Remove a container
docker rm ${ContainerID}
- enfore remove a container event it is runnning
docker rm -f ${ContainerID}
- enfore remove a container event it is runnning
-
Remove all stopped containers
docker container prune
-
Remove an image
docker rmi ${IMAGE_ID}
-
Build an image from a Dockerfile
docker build -t ${repo name}:${tag} . --no-cache
Reference
- Google docker images
- use the Filter to get the desired image.