debian10使用国内源安装docker以及一些使用方法

首先, 我的环境是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

测试

搞掂!

原文地址:https://www.cnblogs.com/surplus/p/11367556.html

时间: 2024-08-30 14:17:22

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

python 使用国内源安装软件

python linux 等 使用国内源安装软件 速度更快 你值得拥有 ! 豆瓣源: https://pypi.douban.com/simple/ 阿里源: http://mirrors.aliyun.com/pypi/simple/ 清华源:https://pypi.tuna.tsinghua.edu.cn/simple/ 华中理工大学源 :http://pypi.hustunique.com/simple/ 山东理工大学 源 :http://pypi.sdutlinux.org/simpl

Ubuntu中安装Docker

安装Ubuntu维护的版本 sudo apt-get install docker.io source /etc/bash_completion.d/docker.io 安装Docker维护的版本 方法一 查看apt的https支持ls /usr/lib/apt/methods/https 若存在跳过步骤2 安装https支持sudo apt-get update && sudo apt-get install -y apt-transport-https 添加仓库echo deb htt

在Kali linux下使用docker配置sqli-labs(国内源的配置和系统软件更新)

本篇blog导航: ~前言 ~第一步:在安装好的kali配置国内源 ~第二步:安装docker ~第三步:docker下安装sqli-labs ~写在最后. 前言: 最近闲来无事,在闯关sqli-labs,但是在less-26之后,遇到了Windows+apache环境下编码的问题,导致闯关不能愉快的进行. 为了解决这一问题,我选择在Kali linux下使用docker配置sqli-labs.话不多说,下面进入正式环节. 我使用了两台虚拟机,一台是kali linux,另一台是Windows

ruby 编译安装,gem国内源ruby.taobao.org

centos6.6final 一.安装依赖包(使用默认CENTOS更新源): # yum install openssl* openssl-devel zlib-devel gcc gcc-c++ make autoconf readline-devel curl-devel expat-devel gettext-devel 二.关闭iptables和SELINUX # service iptables stop # setenforce 0 # vi /etc/sysconfig/selin

7.6 yum更换国内源 7.7 yum下载rpm包 7.8/7.9 源码包安装

7.6 yum更换国内源 7.7 yum下载rpm包 7.8/7.9 源码包安装 扩展 1. 配置yum源优先级 http://ask.apelearn.com/question/7168 2. 把源码包打包成rpm包 http://www.linuxidc.com/Linux/2012-09/70096.htm # 7.6  yum更换国内源 ![mark](http://oqxf7c508.bkt.clouddn.com/blog/20170812/154757717.png?imagesl

yum更换国内源、下载rpm包,源码包安装

yum更换国内源 yum本身自带的yum是国外的地址,国内下载会比较慢. 配置163yum源 rm -f dvd.repo  删除之前默认的yum源 使用wget或curl命令后,生产新的yum源文件CentOS7-Base-163.repo 查看CentOS7-Base-163.repo 下载rpm包 安装扩展epel,yum install -y epel-release安装epel包,目录下生成epel.repo和epel-testing.repo文件. yum list 查看rpm包(y

5周第2次课 yum更换国内源 yum下载rpm包 源码包安装

1. yum 更换国内源 系统内置的源很多时候都是官方的,大部分在国外,使用起来不是很快,也很难下载,这时候最好使用国内的源,如163 1.1 删除系统中自带的 yum源配置文件 mv CentOS-Base.repo CentOS-Base.repo.bak 1.2 下载网易 yum 源的配置文件 wget http://mirrors.163.com/.help/CentOS7-Base-163.repo 或者curl -O http://mirrors.163.com/.help/Cent

7.6 yum更换国内源;7.7 yum下载rpm包;7.8 -7.9 源码包安装

扩展: 1. 配置yum源优先级 http://ask.apelearn.com/question/7168 2. 把源码包打包成rpm包 http://www.linuxidc.com/Linux/2012-09/70096.htm 7.6 yum更换国内源 1. 进入/etc/yum.repos.d目录下: [[email protected] ~]# cd /etc/yum.repos.d 2. 删除本地仓库配置文件:rm -f 仓库配置文件 [[email protected] yum.

五周第二次课(1月9日) 7.6 yum更换国内源 7.7 yum下载rpm包 7.8/7.9 源码包安装

五周第二次课(1月9日)7.6 yum更换国内源7.7 yum下载rpm包7.8/7.9 源码包安装扩展1. 配置yum源优先级 http://ask.apelearn.com/question/7168 2. 把源码包打包成rpm包 http://www.linuxidc.com/Linux/2012-09/70096.htm 命令::================================================================================