直接从镜像仓库拉取
docker pull busybox:latest2. 文件共享
镜像导出成文件
# 拉取镜像 docker pull busybox:latest # 保存镜像去文件 docker save -o myfile.tar busybox:latest
从文件中加载镜像
docker load -i myfile.tar3. Dockerfile
这里我们hello.sh理解为我们需要执行的程序。
文件树
example ├── Dockerfile └── hello.sh
Dockerfile
FROM alpine:latest COPY hello.sh . RUN chmod +x hello.sh CMD ["./hello.sh"]
example.sh
#!/bin/sh echo 'Hello World'
上传到需要的服务器,构建镜像
docker build -t hello:latest .4. 私有Docker Hub
和使用Docker Hub基本一致,只是在拉取镜像时我们需要输入仓库的IP,至于如何搭建就超出本篇文章范围了。
推荐使用:Harbor
docker pull {ip:port}/{team}/{project_name}



