ubuntu 离线安装docker

下载 

http://launchpadlibrarian.net/236916213/libltdl7_2.4.6-0.1_amd64.deb

https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce_17.09.0~ce-0~ubuntu_amd64.deb

(https://github.com/docker/compose/releases)

https://github-releases.githubusercontent.com/15045751/cbfb7480-9d54-11eb-820c-67c0c1e0f065?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210430%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210430T091625Z&X-Amz-Expires=300&X-Amz-Signature=d801faa56164e392461be49d7a9fcceff64980735e55790434e8d641020dc2e3&X-Amz-SignedHeaders=host&actor_id=29697914&key_id=0&repo_id=15045751&response-content-disposition=attachment%3B%20filename%3Ddocker-compose-Linux-x86_64&response-content-type=application%2Foctet-stream

安装
sudo dpkg -i libltdl7_2.4.6-0.1_amd64.deb

sudo dpkg -i docker-ce_17.09.0_ce-0_ubuntu_amd64.deb

mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose 

#mv docker-compose /usr/local/bin/docker-compose 

chmod +x /usr/local/bin/docker-compose

检查

 docker info

docker-compose -v

安装私有仓库 

设置本地仓库配置私有仓库地址为http

{
"registry-mirrors": [
"https://registry.docker-cn.com",
"https://pee6w651.mirror.aliyuncs.com",
"https://hub-mirror.c.163.com",
"https://mirror.baidubce.com"
],
"insecure-registries": [
"http://127.0.0.1:5000"
],
"debug": false,
"experimental": true,
"features": {
"buildkit": true
}
}

打包正常运行的容器为新的镜像

docker commit -a="username" -m="desc" jdk8-font-ttf  my.registry.com:5000/jdk8-font-ttf:v1.0

更改镜像名称 及仓库地址

docker tag  xxxx:v1.0:/my.registry.com:5000/jdk8-font-ttf:v1.1

上传镜像到私有仓库

docker push my.registry.com:5000/jdk8-font-ttf:v1.1

设置客户机私服为http

vi /etc/docker/daemon.json

{ "insecure-registries":["my.registry.com:5000"] }

vi /etc/hosts 

127.0.0.1 my.registry.com

重启docker 服务

systemctl restart docker

从私服pull镜像

docker pull my.registry.com:5000/jdk8-font-ttf:v1.1

编写Dockerfile

编写docker-compose.yml

启动

古之善为士者,微妙玄通,深不可识
原文地址:https://www.cnblogs.com/xzhg/p/14723014.html