Official installation Method https://docs.docker.com/engine/installation/linux/ubuntu/Ubuntu installation package https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/CENTOS7 installation package https://download.docker.com/linux/centos/7/x86_64/stable/packages/Mirrored warehouse https://Hub.daocloud.io/reposCentOS Dependency Packet http://mirrors.163.com/centos/7/os/x86_64/packages/Update RPM Source https://yum.dockerproject.org/repo/main/centos/7/packages/Docker Cloud https://docs.docker.com/docker-cloud/orgs/Docker Mechine https://Github.com/docker/machineHttps//docs.docker.com/machine/VirtualBox https://www.virtualbox.org/wiki/Linux_Downloads[[Email protected]~]$ Service Docker start redirecting to/bin/systemctl start Docker.servicesudoDocker Pull daocloud.io/library/java:openjdk-8u40-B22OPENJDK-8u40-b22:pulling from library/javaa3ed95caeb02:pull Complete 5274d3e5ed75:pull complete 6fd31118c0f5:pull complete 7e92ec83d37b:pull complete 4f 15000735fa:pull Complete 9ea8df248b9e:pull Complete 5b01510e96f0:pull complete digest:sha256: f2ae4c27d2ce5f3c6a97693ef87270c5704348849308bc2d110479355d01ef2astatus:downloaded Newer image fordaocloud.io/library/java:openjdk-8u40-B22 #[email protected]:~$sudoDocker pull Centos#[email protected]:~$sudoDocker pull Ubuntu[email protected]:~$sudoDocker Pull frolvlad/alpine-Oraclejdk8[email protected]:~/temp/dockerimagestemp$sudoDocker images[sudo] Nescafe Password: REPOSITORY TAG IMAGE ID CREATED sizespringcons Umer Latest 1db760c515f04Minutes ago theMbdocker-whale Latest E56CECFCFFF87Hours ago275Mbfrolvlad/alpine-oraclejdk8 Slim a1c742b93b8b2Days ago167Mbubuntu Latest 6a2f32de169d4Days ago117Mbcentos Latest A8493F5F50FFTenDays ago192Mbdocker/whalesay Latest 6b362a9f73eb atMonths ago247Mbdaocloud.io/library/java Openjdk-8u40-b22 0a5e1e22983a2Years ago815Mbdaocloud.io/library/ubuntu Quantal 3E314F95DCAC2Years ago172Mblearn/tutorial Latest A7876479F1AA4Years ago -MB Docker Run< related parameters > < mirroring id> < initial commands >-I: Indicates that the container is running in "interactive mode"-T: Indicates that the container will enter its command line when it is started-V: Indicates which directory needs to be mounted in the container, in the format:-V < host directory >:< container directory > #sudoDocker run-i-t-v/home/nescafe/temp/dockerimagestemp:/app a8493f5f50ff/bin/Bash[email protected]:~/temp/spring_cloud_docker$sudoDocker Build-T Springconsumer. Docker run Springconsumer[email protected]:~/temp/dockerimagestemp$sudoDockerPSCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS namesa0594fdb7007 Springconsumer"sh-c ' Java-jar ..." 3Minutes ago Up3minutes Boring_chandrasekhar [email protected]:~/temp/spring_cloud_docker$sudoDockerRMa0594fdb7007 #springconsumer的容器 [email protected]:~/temp/spring_cloud_docker$sudoDocker rmi 1db760c515f0 #springconsumer #DockerfileFROM Frolvlad/alpine-Oraclejdk8:slimvolume/Tmpadd Spring_cloud_client_consumer-1.4.5. Release.jar App.jarrunSH-C'Touch/app.jar'ENV java_opts=""entrypoint ["SH","- C","Java-jar/app.jar"] #保存迁移镜像 [email protected]:~/temp/spring_cloud_docker$sudoDocker Save-o Docker-image-springconsumer.Tar. GZ springconsumer:latest[email protected]:/home/nescafe/temp/spring_cloud_docker#chmod 777Docker-image-springconsumer.Tar. Gz[email protected]:/home/nescafe/temp/spring_cloud_docker#sudoDocker Load < Docker-image-springconsumer.Tar. gz5922be4c6e3c:loading layer [==================================================>]48.91MB/48.91mb448c94ba5593:loading Layer [==================================================>]48.91MB/48.91MB Loaded image:springconsumer:latest #CentOS7离线安装docker [[email protected] temp]#lsDocker-engine-17.04.0. ce-1. el7.centos.x86_64.rpm libcgroup-0.41- One. el7.x86_64.rpm libcgroup-pam-0.41- One. El7.x86_64.rpmdocker-engine-selinux-17.04.0. ce-1. el7.centos.noarch.rpm libcgroup-devel-0.41- One. el7.x86_64.rpm libcgroup-tools-0.41- One. El7.x86_64.rpm[[email protected] temp]# rpm-IVH libcgroup-*in preparation ... ################################# [ -%] Package Libcgroup-0.41- One. el7.x86_64 has installed the package Libcgroup-tools-0.41- OneThe . EL7.X86_64 has been installed [[email protected] temp]# rpm-IVH docker-engine-selinux-17.04.0. ce-1. EL7.CENTOS.NOARCH.RPM Warning: Docker-engine-selinux-17.04.0. ce-1. el7.centos.noarch.rpm: Head V4 rsa/SHA512 Signature, key ID 2c52609d:nokey in preparation ... ################################# [ -%] is upgrading/Install ...1:d ocker-engine-selinux-17.04.0. ce-################################# [ -%]libsemanage.semanage_direct_install_info:overriding Docker module at Lower -With module at priority -. Restorecon:lstat (/var/lib/docker) Failed:no Suchfileor directory Warning:%post (docker-engine-selinux-17.04.0. ce-1. El7.centos.noarch) script execution failed with exit status code255[email protected] temp]# rpm-IVH docker-engine-Docker-engine-17.04.0. ce-1. el7.centos.x86_64.rpm docker-engine-selinux-17.04.0. ce-1. el7.centos.noarch.rpm [[email protected] temp]# rpm-IVH docker-engine-17.04.0. ce-1. EL7.CENTOS.X86_64.RPM Warning: Docker-engine-17.04.0. ce-1. el7.centos.x86_64.rpm: Head V4 rsa/SHA512 Signature, key ID 2c52609d:nokey in preparation ... ################################# [ -%] is upgrading/Install ...1:d ocker-engine-17.04.0. ce-1. el7.ce################################# [ -%][[email protected] temp]# service Docker startredirecting to/bin/systemctl start Docker.service[[email protected] temp]# Docker-Vdocker version17.04.0-CE, build 4845c56
Run Java jar under Docker Ubuntu/centos