Mac环境下开启docker的远程访问

2022-03-31  本文已影响0人  牍中玉的小木屋
  1. docker登陆账号docker hub
docker run -d --name socat --restart always -p 2375:2375 -v /var/run/docker.sock:/var/run/docker.sock alpine/socat tcp-listen:2375,fork,reuseaddr unix-connect:/var/run/docker.sock
  1. vim .bash_profile
export DOCKER_HOST=tcp://localhost:2375
  1. source .bash_profile
  2. curl localhost:2375/version

================
如果失败了,出现了"Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?"

unset DOCKER_HOST
unset DOCKER_TLS_VERIFY
unset DOCKER_TLS_PATH
docker ps

==========
借鉴资料:

  1. https://blog.csdn.net/u013714073/article/details/88737441?spm=1001.2101.3001.6650.2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-2.pc_relevant_aa
  2. https://www.jianshu.com/p/f37318e09bf5
上一篇 下一篇

猜你喜欢

热点阅读