docker installation and basic commands

1. docker installation

  1) CentOS: sudo yum install docker

  2) Ubuntu:  sudo apt-get docker.io

2. docker commonly used commands

  1) Mirror Download: docker pull mirror name

  2) Check local mirror list: docker images

  3) Delete Mirror: docker rmi image-id

  4) Remove all mirrors: docker rmi $ {docker images -q}

  5) Run the mirror container: docker run --name container-name -d image-name

  6) Check the operation of the container list: docker ps [-a]

  7) Stop the container: docker stop container-name / container-id

  8) Start container: docker start container-name / container-id

  9) Port Mapping: docker run -d -p 8080: 8888 --name container-name image name

  10) delete container: docker rm container-id

  11) Remove all of the containers: docker rm $ {docker ps -a -q}

  12) Check the container log: docker logs container-name / container-id

  13) login container: docker exec -it container-name / container-id bash container is a fully functional Linux system, exit Command Log

  14) compiled from dockerfile Mirror: docker build -t Mirror Mirror directory name

Guess you like

Origin www.cnblogs.com/kwpsz/p/10926901.html
Recommended