list all images:
docker images
list all containers:
docker ps -a
stop all running containers:
docker stop $(docker ps -a -q)
remove all containers:
docker rm $(docker ps -a -q)
force (-f)
remove all running or non-running containers:
docker rm -f $(docker ps -a -q)
remove all images:
docker rmi $(docker images -q)
build docker image with the tag tutorial/webapp:latest from the path .:
docker build -t tutorial/webapp:latest .
download a docker image from the docker hub:
docker pull tutorial/webapp:latest
run the image tutorial/webapp with the specified --name, in the background (-d), exposing inner port 8080 on 80 (-p) and setting an environmental variable (-e):
docker run --name tutorial -d -p 80:8080 -e "ENV_VAR=env-var" tutorial/webapp
run bash console inside the container:
docker exec -it nameofthecontainer /bin/bash
build a docker image from a Dockerfile in the current directory:
docker build --tag my_image .
No comments:
Post a Comment