Linux novice to configure the deployment _ (E) - Installation and use of Docker

Foreword

Recently still considering the deployment of Linux under the net core, or found a lot of troublesome questions, here is what they need to continue to be used to deploy the next introduction.

Docker

In fact, for Docker I am also a star got to understand is not deep enough, generally feeling docker is faster than virtual machine, more convenient, low body mass, rapid deployment of a "virtual machine", this feeling is because docker self into the environment, and do not interference, separate deployment characteristics, we can put mysql, redis, nginx and the like can be deployed separately under docker, can be said to have a docker, you can do whatever they want, of course, I introduced docker, do not do those deployed separately other it.

installation

I do regular habit to switch to the root installation program operation.

  • Yum update package
$ sudo yum update
  • Docker installation script execution
$ yum install -y docker
  • Docker start the process
$ sudo systemctl start docker
  • Set Docker boot from Kai
$ sudo systemctl enable docker
  • Docker verify whether the installation was successful
$ sudo docker run hello-world
$ docker ps -a

Common Commands

Docker Version Information
docker version
Docker System Information
docker info
Mirror Pull
docker pull image_name //默认是最新版本,可以自己写版本号:version
View existing mirror
docker images
Remove Mirror
docker rmi image_name
delete Mirroring
docker rmi $(docker images | grep "<none>" | awk '{print $3}') 
Delete all mirrors
docker rmi `docker images -q`
Conditional remove a mirror
docker rmi --force `docker images | grep keyname | awk '{print $3}}'` //keyname为关键词
Run container
docker run image_name -d -p port:port
Start, stop, restart vessel
docker start -i ID
docker stop -i ID
docker restart -i ID
View container running
docker ps
View all containers
docker ps -a
Kill process container
docker kill -s KILL ID
Save image
docker save -o filename.tar image_name:version
Load the image
docker load -i filename.tar
Export Container
docker export -o filename.tar ID
Import Container
cat ./filepath/filename.tar | sudo docker import - image_name:version
All processes suspended container
docker pause
All recovery process container
docker unpause
Get Logs container
docker logs -f --tail 10 ID //获取最新10条日志记录

summary

Introduction to this, we continue to tinker with net core deployed in the docker in the middle encountered all kinds of really Caton, but now want to move forward, there must be a thorn, if not Phi Jing chopped hemp, it is only stalled, learning is like rowing, 且行且珍惜.

Guess you like

Origin www.cnblogs.com/AprilBlank/p/11752375.html