Methods to quickly deploy docker on ubuntu servers

  • 2020-06-15 10:56:25
  • OfStack

Recently I studied docker, today I learned 1 ubuntu server to quickly deploy docker, so I added 1 little note today.

Install curl


sudo apt-get install curl

Install docker


curl -sSL https://get.daocloud.io/docker | sh

Add a non-ES15en user to docker group (ubuntu in this case)


sudo usermod -aG docker ubuntu

Set daocloud acceleration

step1 register an account with ES26en.daocloud.io

step2 Click the accelerator on personal dashboard to run the script code on the server (pixelated)


curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://******.m.daocloud.io

step3 Restart docker to enable the configuration


sudo service docker restart

Verify that the docker installation was successful


sudo docker run hello-world

docker related commands


docker build -t friendlyname . #  Use under current path Dockerfile create docker The mirror 
docker run -p 4000:80 friendlyname #  run friendlyname will 4000 Port mapping to 80
docker run -d -p 4000:80 friendlyname   # Same thing, but in detached mode
docker ps         #  Display running docker The container 
docker stop <hash>      #  Stop making docker The container 
docker ps -a   #  Show all docker A container that contains none that is running 
docker kill <hash>     #  Compulsory closure formulation docker The container 
docker rm <hash>    #  Removes the schema container from the machine 
docker rm $(docker ps -a -q)   #  Remove all containers from the machine 
docker images -a        # Display all images 
docker rmi <imagename>   #  Remove the mapping from local 
docker rmi $(docker images -q)    #  Remove all images from the machine 
docker login    #  The login docker CLI
docker tag <image> username/repository:tag # Type the image uploaded to the warehouse tag tag 
docker push username/repository:tag   #  Upload the marked image to the repository 
docker run username/repository:tag     #  Run a mirror image of the warehouse 

Related articles: