docker images
: list images on the docker hostdocker pull <image-name>
: copies images to docker hostdocker run <image-name>
: start container from imagedocker info
: show information about dockerdocker version
: show docker versiondocker ps
: list running containersdocker ps -a
docker rmi <image-name>
: remove docker image from docker hostdocker stop $(docker ps -aq)
: stop all active containersdocker rm $(docker ps -a)
: remove all active containerdocker rmi $(docker ps -q)
: remove all docker imagesdocker rm <container id>
: remove stopped containersdocker rm -v <container-id>
: remove container with its volumesdocker stop <container-id>
: stop running containersdocker run -p 8080:3000 -v /var/www node
: run docker with custom volume /var/www into containerdocker run -p 8080:3000 -v $(pwd) /var/www node
: un docker using local location as host location and mount it into container in /var/wwwdocker inspect <container-id>
: shows mounted volume for containerdocker build -t <username>/<app-name> .
: build docker image with tagdocker build -f DockerFile -t <username>/<app-name> .
: build docker image with certain docker file namedocker run -d —name my-postgres postgres
: run container with certain name for linkingdocker run -d -p 3000:3000 —link my-postgres :postgresdb <image-name>
: link other containersdocker exec <container-id> <command>
: to execute command in containerNote:
docker run -d /-it <image-name>
-d to run in background
-it to interact with container terminal