Recently I am learning about docker, and today I learned about the rapid deployment of docker on ubuntu server, so today I add a little note.
Install curl
sudo apt-get install curl
Install docker
curl -sSL https://get.daocloud.io/docker | sh
Add non-root users to the docker group (here is ubuntu)
sudo usermod -aG docker ubuntu
Set daocloud acceleration
step1 Register an account on www.daocloud.io
step2 Click on the accelerator on the personal dashboard, and run the script code on the server (mosaic)
Copy the code code as follows:
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://******.m.daocloud.io
step3 Restart docker to make the configuration take effect
sudo service docker restart
Verify that the docker installation is successful
sudo docker run hello-world
Docker related commands
docker build -t friendlyname . #Use the Dockerfile in the current path to create a docker image
docker run -p 4000:80 friendlyname #Run friendlyname to map port 4000 to 80
docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode
docker ps #Show running docker container
docker stop <hash> #Stop making docker containers
docker ps -a #Show all docker containers, including those that are not running
docker kill <hash> #Forced to close the docker container
docker rm <hash> #Remove the specified container from the machine
docker rm $(docker ps -a -q) #Remove all containers from this machine
docker images -a #Show all mirrors
docker rmi <imagename> #Remove the specified image from the machine
docker rmi $(docker images -q) #Remove all mirrors from this machine
docker login #Log in to the docker CLI
docker tag <image> username/repository:tag #Tag the images uploaded to the warehouse
docker push username/repository:tag #Upload the marked image to the warehouse
docker run username/repository:tag #Run the mirror of the warehouse
The above is the whole content of this article, I hope it will be helpful to everyone's study.
Recommended Posts