docker linux installation

 

Effect 



 

 

 

 

Install 

19. docker installation
method one
yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo yum update
yum install docker-io
docker  version
service docker  start
service docker stop
chkconfig docker on
docker pull centos:latest
Method Two
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager  --add-repo  https://download.docker.com/linux/centos/docker-ce.repo
yum makecache fast
yum install docker-ce
systemctl start docker
docker -v
docker  version
docker images
docker pull hello-world
docker run hello-world
docker pull centos:latest

docker pull hub.c.163.com/library/tomcat:latest
docker pull hub.c.163.com/library/nginx:latest
docker ps # View background processes
#Run docker run -d in the background
docker run -d hub.c.163.com/library/nginx:latest
# enter the container
docker exec --help
docker exec -it  [imagesid] bash
#map ip port server 8080 to container 80
docker run -d -p 8080:80 hub.c.163.com/library/nginx:latest
netstat -na | grep 8080
#Deactivate the container according to the container id
docker stop [imagesid]
#build your own container
docker build  -t jpress:lasted .

Dockerfile
from  hub.c.163.com/library/tomcat
MAINTAINER baoyou [email protected]
COPY jenkins.war /usr/local/tomcat/webapps

docker build -t jenkins:lasted .
docker run -d -p 8080:8080  jenkins:lasted

# delete the image whose imagename is none
docker rmi --force  $(docker images | grep "^<none>" | awk "{print $3}")
# Login to hub.docker.com
docker login
# Upload the image to hub.docker.com
docker push curiousby/jenkins:original

# Save docker images to local
docker save -o centos.tar docker.io/centos
# import from local to docker
docker load -i centos.tar
#copy to container
docker cp ./showandshare.application.otherapplicaition.springbootdubboproducter-0.0.1-SNAPSHOT.jar  d8c1:/root/

 

 

 Notice 

1. If there is no service service for the baoyou user. Remove the need to add groups every time sudo runs the docker command

sudo groupadd docker
sudo gpasswd -a ${USER} docker

 or gpasswd -a baoyou docker

 

 2. Virtual machine docker self-start

chkconfig docker on  

 

 

 

 

 

 

 

 

 

 

 

Donate to developers 

Driven by interest, I write 免费something with joy and sweat. I hope you like my work and can support it at the same time. Of course, if you have money to support a money field (support Alipay, WeChat, and the buckle group), if you have no money to support a personal field, thank you.

 

Personal homepage : http://knight-black-bob.iteye.com/



 
 
 Thank you for your sponsorship, I will do better!

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326845450&siteId=291194637