Install
sudo apt-get install docker sudo apt install docker.so |
Reference: Install Docker Engine on Ubuntu | Docker Documentation
Start the docker service
systemctl status docker sudo systemctl start docker sudoo systemctl restart docker # restart |
mirror image
docker pull image # get image docker rmi image # delete docker images docker search xxx # Query in the warehouse docker commit -m="xxx" -a="author" iamge_id target_image_name # update image # save image docker save [options] images [images_id...] exp. docker save -o new_image.tar old_image:v1.0 docker load -i image # load image # Save the container to the image docker commit container_name image_name:version |
container
docker run -it image_name /bin/bash docker run -itd image_name /bin/bash # background start docker run -it -p 5055:22 --name container_name image_name /bin/bash docker run -it -p 5055:22 --name container_name -v local_dir:container_dir image_name bash # Mount the local directory into the image exit /ctrl+d # Exit the container docker ps -a # list running container docker stop container docker start container # start a stopped container docker exec -it container # enter a running container docker rm container docker rename container_name new_name |
tips finishing
docker must use sudo permission to take effect
Mount operation in docker container - take a look (privileged started container)