docker tag 踩坑之路
docker菜狗子,高级的功能未使用,就用来拉镜像打tag,非喜勿喷!
- 平台:MacBook Air (M1, 2020)
一、安装
这一步很简单
https://docs.docker.com/desktop/install/mac-install/ 下载安装即可
二、踩坑
1、App无法正常打开,Exit Code 152
com.docker.backend cannot start
Exit code 152
报错的弹框上点diagnose会跳转到docker的错误码指导页面,但也解决不了什么问题。
一顿搜索,终于在stackoverflow上找到了解决方法。
跟着以下七步走就可以成功解决这个问题,正常打开app,优雅的使用Docker了。
1. Go to finder and open Applications > Utilities > Activity Monitor.app
2. Find Docker or Docker Desktop (it was in Not responding mode in my case) and Force Kill the app.
3. Run the following command in Terminal:
sudo rm -rf ~/Library/Containers/com.docker.*
4. Open the setting file in the terminal:
sudo nano ~/Library/Group\ Containers/group.com.docker/settings.json
then find "filesharingDirectories":
5. Remove all entries inside this key and leave it as "filesharingDirectories": [], save and close the file.
6. Finally go to the Application folder, find Docker and run it (wait sometime, it takes a minute or so to run)
7. It will run and work like a charm!
2、证书不受信任
证书不受信任,如果是自己站点,可以配置的话,可以去改一下证书。如果自己不可控,只能让我们自己去信任这个证书。
mac上如何去信任这个证书?
我的方式是:
-
去浏览器访问目标网站
-
从浏览器导出证书(记住保存的目录)
-
找到keychain Accss -system keychains-system
将刚刚下载的证书.cer文件拖进去,弹框提示是否允许-允许一下 -
信任它
在keychain Accss -system keychains-system找到刚刚拖进去的证书-双击-编辑信任选项
关闭弹窗-再次允许一下
三、登录Docker
到了这一步,终于可以愉快得登录docker了
注意:如果重启terminal不生效,重启一下电脑,同事遇到过这样的情况,重启电脑才生效。
四、拉镜像
docker pull 镜像路径/镜像名称
又闹什么幺蛾子?
deamon在计算机中是指守护进程,知道了含义一下就明白了是因为守护进程没起,需要打开客户端
。
打开客户端再次拉镜像
这下终于舒服了。
五、相关命令行
docker login serverAddress
docker pull imageA
docker tag imageA imageB
docker push imageB
注:imageA 和打了tag后的imageB都是路径/镜像名称
的形式