docker+apt-get找不到命令
作者:David的日常
该篇教程主要讲解安装Docker容器和Portainer的简单安装和使用
Tip:
这里我选择在LXC容器下安装Docker,主要是起到隔离作用,当然你也可以直接在PVE下面直接安装。
主要流程目录:
1.安装Docker
2.安装Portainer
2.1.环境IP
2.2.镜像仓库
2.3.简单使用
1.安装Docker
获取Docker一键安装脚本
https://linuxmirrors.cn/
![](https://p0.ssl.img.360kuai.com/t01a631bd2de659ab8c.jpg)
检测一下是否已经安装curl
curl -V\n\n//没有安装的,输入下面命令进行安装\napt install curl -y
![](https://p0.ssl.img.360kuai.com/t0158e7c576815e1d2d.jpg)
运行一键安装脚本
bash
![](https://p0.ssl.img.360kuai.com/t0149db2c7cc9d1f31a.jpg)
输入Y,确认安装
![](https://p0.ssl.img.360kuai.com/t011d70946cfdce8f56.jpg)
随便选一个就行
![](https://p0.ssl.img.360kuai.com/t0121087c2342fe466f.jpg)
随便选一个就行
![](https://p0.ssl.img.360kuai.com/t013c072aac26c12cee.jpg)
Docker已经安装完成
![](https://p0.ssl.img.360kuai.com/t0130e284395c38238a.jpg)
Tip:
简单docker命令:
//列出所有的Docker数据卷\ndocker volume ls\n\n//删除数据卷\ndocker volume rm 数据卷名称\n\n//列出所有容器\ndocker ps -a\n\n//强制删除容器\ndocker rm -f 容器名称
2.安装Portainer
安装Portainer,这里我安装的是中文版
中文版:docker volume create portainer_datadocker run -d --restart=always --name="portainer" -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data 6053537/portainer-ce:latest官方版:docker volume create portainer_datadocker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
这里我直接安装中文版portainer
![](https://p0.ssl.img.360kuai.com/t0155f997b2f2dd7f4e.jpg)
Tip:
如果出现如下报错“Error response from daemon: Get "https://registry-1.docker.io/v2/": context deadline exceeded.”,首先需要确定网络Ping没问题和镜像是否存在。
nano /etc/resolv.conf\n\n屏蔽原来的:\n192.168.xx.xx\n\n添加:\nnameserver 114.114.114.114 nameserver 8.8.8.8
安装完成
![](https://p0.ssl.img.360kuai.com/t013913e0677c73ebaa.jpg)
浏览器访问portainer,输入IP+端口号(比如我就是:192.168.31.83:9000)
![](https://p0.ssl.img.360kuai.com/t01f36803632eefb377.jpg)
Tip:
忘记IP的可以这里查看
![](https://p0.ssl.img.360kuai.com/t014a0a2d6c3912764a.jpg)
输入密码,点击“创建用户”
![](https://p0.ssl.img.360kuai.com/t017fc7cd47fd774e9f.jpg)
Tip:
提示需要重启容器,输入下面命令后刷新界面
docker restart portainer
进入面板
![](https://p0.ssl.img.360kuai.com/t01a2eab71dbf750cd6.jpg)
2.1.环境IP
修改IP是为了安装好其他Dokcer镜像以后,点击端口号方便跳转
环境 -> local
![](https://p0.ssl.img.360kuai.com/t019b393cc091812400.jpg)
填写为当前网页的IP地址
![](https://p0.ssl.img.360kuai.com/t01de2b858636dc2527.jpg)
2.2.镜像仓库
修改注册表可以让拉取更加快速
镜像仓库 -> 添加注册表
![](https://p0.ssl.img.360kuai.com/t0151669bbe22f12263.jpg)
自定义注册表
![](https://p0.ssl.img.360kuai.com/t0164e52aedcb73000e.jpg)
Docker中国区官方镜像\nhttps://registry.docker-cn.com\n\n网易\nhttps://hub-mirror.c.163.com/\n\nustc\nhttps://docker.mirrors.ustc.edu.cn
2.3.简单使用
点击“首页”
![](https://p0.ssl.img.360kuai.com/t012e782de9fedd8e8a.jpg)
切换到local环境
![](https://p0.ssl.img.360kuai.com/t0184b32d699ceca9c7.jpg)
平时常用操作都在这边
![](https://p0.ssl.img.360kuai.com/t0157807be74bfc6cf1.jpg)
简单演示一下安装步骤
容器 -> 添加容器
![](https://p0.ssl.img.360kuai.com/t018ef89fdf1d69f8fb.jpg)
填写创建容器
![](https://p0.ssl.img.360kuai.com/t01f22a5a3f91ae5fdf.jpg)
担心网络拉取慢,可以选择国内的镜像源(之前上面添加的)
![](https://p0.ssl.img.360kuai.com/t012eef38a1b3c8df8c.jpg)
完成安装,点击端口号即可便捷跳转(因为设置过环境IP)
![](https://p0.ssl.img.360kuai.com/t0117a17f0dccaeb956.jpg)
正常运行
![](https://p0.ssl.img.360kuai.com/t019e66fec2dc7c8a8d.jpg)
查看文章精彩评论,请前往什么值得买进行阅读互动
","gnid":"9df9c277b978769a3","img_data":[{"flag":2,"img":[{"desc":"","height":"618","title":"","url":"https://p0.ssl.img.360kuai.com/t01a631bd2de659ab8c.jpg","width":"1080"},{"desc":"","height":"419","title":"","url":"https://p0.ssl.img.360kuai.com/t0158e7c576815e1d2d.jpg","width":"1080"},{"desc":"","height":"429","title":"","url":"https://p0.ssl.img.360kuai.com/t0149db2c7cc9d1f31a.jpg","width":"1080"},{"desc":"","height":"228","title":"","url":"https://p0.ssl.img.360kuai.com/t011d70946cfdce8f56.jpg","width":"645"},{"desc":"","height":"315","title":"","url":"https://p0.ssl.img.360kuai.com/t0121087c2342fe466f.jpg","width":"748"},{"desc":"","height":"649","title":"","url":"https://p0.ssl.img.360kuai.com/t013c072aac26c12cee.jpg","width":"776"},{"desc":"","height":"317","title":"","url":"https://p0.ssl.img.360kuai.com/t0130e284395c38238a.jpg","width":"704"},{"desc":"","height":"145","title":"","url":"https://p0.ssl.img.360kuai.com/t0155f997b2f2dd7f4e.jpg","width":"1080"},{"desc":"","height":"422","title":"","url":"https://p0.ssl.img.360kuai.com/t013913e0677c73ebaa.jpg","width":"1080"},{"desc":"","height":"536","title":"","url":"https://p0.ssl.img.360kuai.com/t01f36803632eefb377.jpg","width":"1080"},{"desc":"","height":"376","title":"","url":"https://p0.ssl.img.360kuai.com/t014a0a2d6c3912764a.jpg","width":"1080"},{"desc":"","height":"710","title":"","url":"https://p0.ssl.img.360kuai.com/t017fc7cd47fd774e9f.jpg","width":"1080"},{"desc":"","height":"536","title":"","url":"https://p0.ssl.img.360kuai.com/t01a2eab71dbf750cd6.jpg","width":"1080"},{"desc":"","height":"572","title":"","url":"https://p0.ssl.img.360kuai.com/t019b393cc091812400.jpg","width":"1080"},{"desc":"","height":"398","title":"","url":"https://p0.ssl.img.360kuai.com/t01de2b858636dc2527.jpg","width":"1080"},{"desc":"","height":"386","title":"","url":"https://p0.ssl.img.360kuai.com/t0151669bbe22f12263.jpg","width":"1080"},{"desc":"","height":"669","title":"","url":"https://p0.ssl.img.360kuai.com/t0164e52aedcb73000e.jpg","width":"1080"},{"desc":"","height":"351","title":"","url":"https://p0.ssl.img.360kuai.com/t012e782de9fedd8e8a.jpg","width":"1080"},{"desc":"","height":"357","title":"","url":"https://p0.ssl.img.360kuai.com/t0184b32d699ceca9c7.jpg","width":"1080"},{"desc":"","height":"536","title":"","url":"https://p0.ssl.img.360kuai.com/t0157807be74bfc6cf1.jpg","width":"1080"},{"desc":"","height":"364","title":"","url":"https://p0.ssl.img.360kuai.com/t018ef89fdf1d69f8fb.jpg","width":"1080"},{"desc":"","height":"669","title":"","url":"https://p0.ssl.img.360kuai.com/t01f22a5a3f91ae5fdf.jpg","width":"1080"},{"desc":"","height":"366","title":"","url":"https://p0.ssl.img.360kuai.com/t012eef38a1b3c8df8c.jpg","width":"1080"},{"desc":"","height":"365","title":"","url":"https://p0.ssl.img.360kuai.com/t0117a17f0dccaeb956.jpg","width":"1080"},{"desc":"","height":"366","title":"","url":"https://p0.ssl.img.360kuai.com/t019e66fec2dc7c8a8d.jpg","width":"1080"}]}],"original":0,"pat":"art_src_1,fts0,sts0","powerby":"pika","pub_time":1696421737000,"pure":"","rawurl":"http://zm.news.so.com/0e2bbe917810bb28ea2d84a7cfd797d1","redirect":0,"rptid":"467b623a4bcdee21","rss_ext":[],"s":"t","src":"什么值得买","tag":[],"title":"PVE篇!LXC安装Docker和Portainer
党奚初3020如何在CentOS下安装部署Jenkins持续集成环境 -
曲窦琦13816338659 ______ 1. 安装 Docker 首先,我们要安装 docker,因为这是 Drone 的工作流的最关键的元素.Drone 合理的利用了 docker 来构建和测试应用.容器技术提高了应用部署的效率.要安装 docker ,我们需要在不同的 linux 发行版本运行下面对应的命令,...
党奚初3020docker run.sh要自己写吗 -
曲窦琦13816338659 ______ docker run指定的命令如果不是那些一直挂起的命令(比如运行top,不断echo),就是会自动退出的.-d命令是设置detach为true,根据官方的文档,意思是让这个命令在后台运行,但并不是一直运行(我们在一个正常的Linux Terminal中运行/...
党奚初3020i know it is i( ) difficult to run a marathon ,but i still want to have to try -
曲窦琦13816338659 ______ i know it is (immensely) difficult to run a marathon, but i still want to have to try i know it is (impossibly) difficult to run a marathon, but i still want to have to try 都可以 immensely difficult 非常困难 impossibly difficult 几乎无法超越地困难 满意请及时采纳,谢!
党奚初3020怎样实现修改配置文件立马生效,而不需要重新启动服务 -
曲窦琦13816338659 ______ 注销账户重新登入试试,有些软件可以得,有些就不一定管用.
党奚初3020ubuntu上制作的docker镜像可以在其他linux上跑吗 -
曲窦琦13816338659 ______ docker 可以跨linux平台的,ubuntu 上运行个centos的docker完全可以.
党奚初3020centos7 docker容器启动后怎么端口映射 -
曲窦琦13816338659 ______ docker容器操作状态变换快,你可以重启一个新的容器并做端口映射. 如果实在不想重启的话,只有自己手动操作防火墙了,看如下用例: iptables -t nat -A DOCKER -p tcp --dport 8001 -j DNAT --to-destination 172.17.0.19:8000以上,请根据实际情况替换.
党奚初3020docker ubuntu用什么版本 -
曲窦琦13816338659 ______ 当前Ubuntu 系统下的 Docker 的安装包只提供64位.如果你想运行32位的 Docker,你需要. 安装 Docker 通过 apt-get 安装 Docker 简直是小菜一碟. $ sudo apt-get install docker.io 如果你不是 root 组的用户,你可以把自己加入到 docker 用...
党奚初3020docker怎么清理容器的文件 -
曲窦琦13816338659 ______ # 杀死所有正在运行的容器. alias dockerkill='docker kill $(docker ps -a -q)' # 删除所有已经停止的容器. alias dockercleanc='docker rm $(docker ps -a -q)' # 删除所有未打标签的镜像. alias dockercleani='docker rmi $(docker images -q -f dangling=...
党奚初3020docker容器里怎么获得容器号 -
曲窦琦13816338659 ______ 熟悉 Linux 技术都知道容器利用名字空间进行隔离进程已Docker 容器实现利用 Linux 自身技术 候我需要宿主机容器内进行些操作种绕 Docker 操作式并推荐 使用比较新 Docker 版本尴尬发现直接使用系统命令访问容器名字空间 首先介绍 ip netns ...
党奚初3020如何从零开始搭建Docker Swarm集群 -
曲窦琦13816338659 ______ 检查节点Docker配置 1. 打开Docker配置文件(示例是centos 7) vim /etc/sysconfig/docker 2. 添加-H tcp://0.0.0.0:2375到OPTIONS OPTIONS='-g /cutome-path/docker -H tcp://0.0.0.0:2375' 3. CentOS6.6 需要另外添加-H unix:///var/run/docker....