首先, 我的环境是debian, 容器是centos

debian

安装添加新存储库所需的依赖项

1
sudo apt install ca-certificates curl software-properties-common gnupg2

扔源

1
2
# deb-src [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/debian buster stable
deb [arch=amd64] http://mirrors.ustc.edu.cn/docker-ce/linux/debian buster stable  

使用以下 curl 命令导入存储库的 GPG 密钥:

1
curl -fsSL http://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg | sudo apt-key add -

然后apt update在install

1
apt-get install docker-ce

开启服务

1
systemctl start docker

然后拉取文件这些不说了

docker映射端口和挂载目录

1
2
                  宿主 容器    宿主 容器    宿主  容器
docker run -it -p 8083:8080 -p 3389:3306 -v /mnt/:/mnt update /bin/bash

导出容器

1
2
                    新名字     容器名字
docker export -o cheng.tar confident_hopper

导入容器

1
2
                        新名字
docker import cheng.tar cheng

下面是镜像问题

(镜像不能重复, 假如是备份原来的镜像cheng, 那么要导入新的镜像update.tar的时候就需要删除现有的cheng镜像, 不然导入失败, 因为当update.tar导入后会变成cheng名字的镜像, 两者名字不能重复, 如果使用export则无此问题)

导出镜像

1
docker save -o update.tar cheng

导入镜像

1
docker load -i update.tar

下面有三点需要注意的

1
2
3
1. docker save保存的是镜像(image),docker export保存的是容器(container)。
2. docker load用来载入镜像包,docker import用来载入容器包,但两者都会恢复为镜像。
3. docker load不能对载入的镜像重命名,而docker import可以为镜像指定新名称。

进入容器

1
2
                    容器名
docker exec -it condescending_franklin /bin/bash

进入容器的方式有4种, 请参考

Docker容器进入的4种方式

下面看下案例

查看端口映射问题

centos

centos我是直接使用rpm包的, 只要两个包

主包: docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm

1
wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm

依赖: docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm

1
wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm

安装方式yum, 为什么要用yum呢, yum可以解决依赖问题, 安装的时候需要安装noarch先, 因为它会自动搞掂依赖

1
yum install docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm

1
yum install docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm

测试

搞掂!

debian10使用国内源安装docker以及一些使用方法的更多相关文章

  1. debian9使用国内源安装docker以及一些使用方法

    debian9使用国内源安装docker以及一些使用方法   首先, 我的环境是debian, 容器是centos debian 扔源 # deb-src [arch=amd64] https://m ...

  2. ubuntu 16.04 国内源安装docker

    1. 通过curl命令安装 检查是否安装curl root@ros-OptiPlex-3050:~# which curlroot@ros-OptiPlex-3050:~# 更新安装 root@ros ...

  3. python 使用国内源安装软件

    python linux 等 使用国内源安装软件 速度更快 你值得拥有 ! 豆瓣源:pip install -i https://pypi.douban.com/simple/ 阿里源:pip ins ...

  4. ubuntu ARM换国内源和国内源安装ROS

    ubuntu arm换国内源: https://www.cnblogs.com/yongy1030/p/10315569.html 国内源安装ROS: https://blog.csdn.net/ch ...

  5. centos7 安装zabbix3.0 安装zabbix4.0 yum安装zabbix 国内源安装zabbix 阿里云服务器安装zabbix

    首先,此篇文章是有原因的. 刚开始也和大家一样来学习安装zabbix 奈何网上的教程和现实出现不一样的情况 在安装zabbix过程中,因为zabbix下载源是在国外,下载途中会出现终止下载的情况 tr ...

  6. (原+修改)Pip使用国内源安装opencv

    转载请注明出处: https://www.cnblogs.com/darkknightzh/p/12000823.html 参考网址: https://www.imooc.com/article/34 ...

  7. jenkins 2.204.2 安装, 使用国内源安装, 并且跳过插件界面, 更新成国内插件源.

    需要java环境支持,自行百度. jenkins 安装源在国外, 下载会比较慢, 尤其在linux下, 使用yum或者apt install jenkins方式安装时,经常会下载失败. 由于yum或者 ...

  8. pip 使用国内源安装第三方库

    pip3 install django -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com​

  9. debian10切换国内源

    Debian 10.3 下载地址: http://mirrors.163.com/debian-cd/10.3.0-live/amd64/iso-hybrid/debian-live-10.3.0-a ...

随机推荐

  1. python小作业

    目录 1.简述变量命名规范 2.name = input(">>>") name变量是什么数据类型通过代码检测 3.if条件语句的基本结构? 4.用print打印 ...

  2. InheritedWidget and screen

    self: import 'package:flutter/material.dart'; class GrantScreen { static double _width, _height; sta ...

  3. Bean named 'XXX' is expected to be of type [XXX] but was actually of type [com.sun.proxy.$Proxy7

    AOP原理 <aop:aspectj-autoproxy />声明自动为spring容器中那些配置@aspectJ切面的bean创建代理,织入切面. <aop:aspectj-aut ...

  4. 【转载】 C#中使用float.Parse方法将字符串转换为Float类型

    在C#编程过程中,很多时候涉及到数据类型的转换,例如将字符串类型的变量转换为单精度Float类型就是一个常见的类型转换操作,float.Parse方法是C#中专门用来将字符串转换为float类型的,f ...

  5. 【转载】C#中List集合使用Max()方法查找到最大值

    在C#的List集合操作中,有时候需要查找到List集合中的最大值,此时可以使用List集合的扩展方法Max方法,Max方法有2种形式,一种是不带任何参数的形式,适用于一些值类型变量的List集合,另 ...

  6. tcp、udp协议栈

    tcp struct tcphdr { __be16 source; //源端口 __be16 dest; //目的端口 __be32 seq; //序列号 __be32 ack_seq; //确认号 ...

  7. java HttpClient操作工具类

    maven: <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId> ...

  8. php环境Unknown column '*' in 'field list'解决方案

    在使用pymysql 做网站往数据库插入数据时发现如下错误:pymysql.err.InternalError: (1054, "Unknown column '*' in 'field l ...

  9. golang之网络开发

    TCP Server/Client开发 net包提供network I/O开发接口,包括TCP/IP.UDP.DNS和Unix domain sockets. 常用开发一般仅需要最基础接口或函数: 服 ...

  10. NFS服务启动:rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)

    nfs重启时提示: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused) 解决办法: 1 #service rpc ...