docker deepin_docker套件用法

docker deepin_docker套件用法卸载1.卸载docker-cesudoapt-getremovedockerdocker-ce2.查看docker的文件位置whereisdocker结果如下:docker:/usr/bin/docker/etc/docker/usr/libexec/docker/usr/share/man/man1/docker.1.gz3.删除docker文件使用rm-rf命令删除这些文件如:sudorm-rf/usr/bin/docker删除后,可以使用dock

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

卸载

1.卸载docker-ce

sudo apt-get remove docker docker-ce

2.查看docker的文件位置

whereis docker

结果如下:

docker: /usr/bin/docker /etc/docker /usr/libexec/docker /usr/share/man/man1/docker.1.gz

3.删除docker文件

使用rm -rf命令删除这些文件

如:

sudo rm -rf /usr/bin/docker

删除后,可以使用dockerwhich命令

dream@dream-PC:~$ docker
bash: docker: 未找到命令
dream@dream-PC:~$ which docker
dream@dream-PC:~$ 

可以看到docker已被卸载

安装

1.安装docker密钥

dream@dream-PC:~$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
OK

2.查看秘钥是否安装成功

dream@dream-PC:~$ sudo apt-key fingerprint 0EBFCD88
pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid           [ unknown] Docker Release (CE deb) <docker@docker.com>
sub   rsa4096 2017-02-22 [S]

3.添加docker官方仓库

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian wheezy stable"

上面命令中wheezy为debian版本号的代号,可通过cat /etc/debian_version查看版本,对应代号关系如下:

deepin15.5 ==> debian8.0 ==> jessie
deepin15.9.2 ==> debian9.0 ==> stretch
deepin20 ==> debian10 ==> buster

这里会报错,但不会影响docker正常安装

aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Deepin/camel

4.安装docker-ce

sudo apt-get install docker-ce

5.查看docker版本

dream@dream-PC:~$ docker version
Client: Docker Engine - Community
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:45:52 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       48a66213fe
  Built:            Mon Jun 22 15:44:23 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

6.运行hello-world容器

dream@dream-PC:~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:d58e752213a51785838f9eed2b7a498ffa1cb3aa7f946dda11af39286c3db9a9
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

可以看到15行,显示docker可以正常运行了。

由于系统盘容量较小,所以想将docker的相关文件移动到数据盘。

修改docker数据目录

修改/etc/docker/daemon.json

若没有daemon.json文件,使用以下命令可自动创建

dream@dream-PC:~$ sudo vim /etc/docker/daemon.json

在该文件中写入以下数据

{ 
   
    "data-root": "/home/dream/docker"
}

目录可以自定义

重启docker

systemctl restart docker

查看该目录,可以看到相关文件

dream@dream-PC:~$ cd /home/dream/docker/
dream@dream-PC:~/docker$ ls
builder   containers  network   plugins   swarm  trust
buildkit  image       overlay2  runtimes  tmp    volumes
dream@dream-PC:~/docker$ 

添加docker镜像源

还是修改daemon.json文件

在文件中加入镜像源地址,daemon.json内容如下:

{ 
   
    "data-root": "/home/dream/docker",
    "registry-mirrors": ["http://registry.docker-cn.com",
        "http://hub-mirror.c.163.com",
        "http://docker.mirrors.ustc.edu.cn"]
}
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/196169.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Petalinux系列——0.在Docker里玩转PetaLinux

    Petalinux系列——0.在Docker里玩转PetaLinux在Docker里玩转PetaLinux来自https://github.com/alexhegit/https://mp.weixin.qq.com/s/spaq_Sv1giraeIJgsKDQYA简介PetaLinuxPetaLinux是Xilinx推出的针对ZynqSoc,ZynqMPSOC嵌入式开发板的基于Yocto二次封装的LinuxBSP构建工具,支持Ubuntu…

    2025年10月28日
    6
  • docker新建镜像_docker基础镜像和项目镜像

    docker新建镜像_docker基础镜像和项目镜像Docker创建镜像、修改、上传镜像–创建镜像有很多方法,用户可以从DockerHub获取已有镜像并更新,也可以利用本地文件系统创建一个。一、创建镜像创建镜像有很多方法,用户可以从Do

    2022年8月2日
    11
  • docker安装RabbitMQ「建议收藏」

    docker安装RabbitMQ「建议收藏」docker安装RabbitMQ查看仓库里的RabbitMQdockersearchrabbitmq安装RabbitMQdockerpullrabbitmq这里是直接安装最新的,如果需要安装其他版本在rabbitmq后面跟上版本号即可启动RabbitMQdockerrun-d–hostnamemy-rabbit–namerabbit-p15672:15672-p5672:5672rabbitmq安装插件先执行dockerps拿到当前的镜像ID

    2022年5月24日
    39
  • Docker 容器中运行 Docker 命令

    Docker 容器中运行 Docker 命令Docker容器中运行Docker命令在使用GitLab/Jenkins等CI软件的时候需要使用Docker命令来构建镜像,需要在容器中使用Docker命令;通过将宿主机的Docker共享给容器即可在启动容器时添加以下命令:–privileged\-v/var/run/docker.sock:/var/run/doc…

    2022年5月16日
    41
  • docker的网络_docker网络模式详解

    docker的网络_docker网络模式详解1.Docker网络模式Docker默认提供了3种网络模式,生成容器时不指定网络模式下默认使用bridge桥接模式。使用命令查看当前Docker所有的网络模式。[root@hahadocker_web]#dockernetworklsNETWORKIDNAMEDRIVERSCOPEaa8a26ae1484bridgebridgelocal62cd016ed66ahosthostlocalfc650e2

    2025年6月18日
    3
  • docker部署mysql的坏处_docker创建mysql数据库

    docker部署mysql的坏处_docker创建mysql数据库首先,确认创建容器的时候添加了-d参数,以守护进程的方式运行容器。或者,之前容器能够正常启动,突然启动不了,可以参考下面的解决方案。使用free命令查看内存状态[root@VM-16-15-centos~]#freetotalusedfreesharedbuff/cacheavailableMem:38263362077648504884220812

    2022年9月26日
    2

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号