首页 > 其他分享 >docker安装笔记及常见问题解决

docker安装笔记及常见问题解决

时间:2023-03-13 20:56:36浏览次数:48  
标签:bin compose 笔记 常见问题 yum docker Docker latest

1. yum安装gcc相关环境

yum -y install gcc
yum -y install gcc-c++

2. 卸载旧版本(非必要)

yum remove docker \
    docker-client \
    docker-client-latest \
    docker-common \
    docker-latest \
    docker-latest-logrotate \
    docker-logrotate \
    docker-engine

3. 安装需要的软件包

yum install -y yum-utils

4. 设置镜像仓库

# 正确推荐使用国内的
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

5. 安装Docker

yum install docker-ce docker-ce-cli containerd.io

6. 启动Docker

systemctl start docker

7. 设置Docker开机自启

systemctl enable docker

8. 修改Docker的配置文件

  • vim /etc/docker/daemon.json
{
  "data-root":"/mnt/docker"  # 默认docker的数据存放路径
}

  • 重启docker
systemctl restart docker
  • 验证修改是否成功
docker info|grep 'Docker Root Dir'
#结果如下所示:
Docker Root Dir: /mnt/docker

9. 验证Docker是否安装完成

  • docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:6e8b6f026e0b9c419ea0fd02d3905dd0952ad1feea67543f525c73a0a790fefb
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/

10. 安装docker-compose

curl -SL https://get.daocloud.io/docker/compose/releases/download/v2.16.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
# 国内
curl -SL https://get.daocloud.io/docker/compose/releases/download/v2.16.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

# 添加执行权限
chmod +x /usr/local/bin/docker-compose
# 软连接
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# 验证
docker-compose version

标签:bin,compose,笔记,常见问题,yum,docker,Docker,latest
From: https://www.cnblogs.com/JentZhang/p/17212818.html

相关文章

  • 3.13python笔记
    1.print(str[0:-1])如上图所示,str[0:-1]为切片,意思是从前面开始截取到后面-1为止,所以输出第一个到倒数第二个的所有字符str="abcdef"print(str[0:-1])输出:abcde1232.pr......
  • Gradient-based Editing of Memory Examples for Online Task-free Continual Learnin
    摘要:在缺少明确的任务边界和任务标识的情况下,本文探索了task-freecontinuallearning(任务具有独立的数据标签空间,在训练和测试的过程中不提供任务识别符),在这个场景中需......
  • Docker 容器中使用PING命令报错
    报错原因下载的镜像是阉割版的有好多命令是没有的然后在这里提醒大家提前下载好需要用到的指令在镜像中解决方法dockerexec-ittomcat01/bin/bash执行aptinstall......
  • docker部署
    docker部署第一步:设置yum源为docker  yum源cd/etc/yum.repos.d/rm-rf*.repowget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repoyumcleana......
  • Docker搭建MySQL集群
    采用MySQL架构PerconaXtraDBCluster1.安装PXC集群#用pull拉PXC5.7.20版本[root@localhost~]#dockerpullpercona/percona-xtradb-cluster:5.7.205.7.20:Pulli......
  • 20230313>笔记本小升级PM991A
     新款的PM991a,有且仅有2230长度,大板子需自备转换器转成2241,2260,或者2280.  PM991a完全是小设备的福音的。以下是参数:本次产品容量512Gb, 产于2023年1月。 PM......
  • PowerDesigner中几个常见问题的解决方法
    1.生成的字段或者表名英文字母默认全为大写,在实际使用中一般是小写:  2.模型中显示“Name”或“Code”,如何切换? 3.去掉生成表中加上的双引号"" ......
  • Docker - docker ps 指定输出格式
    在服务器上查看当前docker容器,会折行展示,看着很乱网上没找到相关的美化命令行工具办法一:less命令#-e:文件内容显示完毕后,按任意键退出#-S:在单行显示较长的内容,而......
  • 4.docker错误Error response from daemon: driver failed programming external conne
    1.docker端口映射或启动容器时报错Errorresponsefromdaemon:driverfailedprogrammingexternalconnectivityonendpointquirky_allenErrorresponsefromdaemon......
  • 5.docker容器磁盘不够
    引言docker所在服务器,在运行了一段时间后,服务器磁盘目录渐渐不够用。 通过du-h--max-depth=1/ 逐级目录排查,发现/var/lib/docker目录文件过大。 解决方法转移......