微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Docker安装与基础命令

Docker安装与基础命令

Docker安装:阿里源镜地址

1、Ubuntu 14.04/16.04(使用 apt-get 进行安装)
# step 1: 安装必要的一些系统工具
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# step 2: 安装GPG证书
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# Step 3: 写入软件源信息
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# Step 4: 更新并安装Docker-CE
sudo apt-get -y update
sudo apt-get -y install docker-ce

# 安装指定版本的Docker-CE:
# Step 1: 查找Docker-CE的版本:
# apt-cache madison docker-ce
#   docker-ce | 17.03.1~ce-0~ubuntu-xenial | https://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
#   docker-ce | 17.03.0~ce-0~ubuntu-xenial | https://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
# Step 2: 安装指定版本的Docker-CE: (VERSION例如上面的17.03.1~ce-0~ubuntu-xenial)
# sudo apt-get -y install docker-ce=[VERSION]
2、配置镜像加速:

Docker基础命令:

  • 下载镜像
上传镜像

docker push xx/Nginx

# 搜索镜像

docker search Nginx

查看镜像

docker image ls

删除镜像

docker image rm 镜像ID

导出镜像

docker save ngixn:latest -o Nginx_latest.tar.gz

指定导入名称

docker import Nginx_latest.tar.gz

导入镜像

docker load -i Nginx_latest.tar.gz

镜像打标签

docker tag ngixn:latest harbor.superops.cc/ngixn:latest

查看指定镜像的创建历史

docker image history harbor.superops.cc/ngixn:latest

获取镜像元数据信息

docker image inspect Nginx

清理镜像

docker image prune

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐