美文网首页
MAC Docker 开启远程连接服务

MAC Docker 开启远程连接服务

作者: quanCN | 来源:发表于2021-02-03 20:04 被阅读0次

简介

Docker提供了Remote API,可以通过REST方式的接口进行操作,但是在MacOS上Docker Desktop CE的缺省安装,却无法使用,这篇文章继续介绍如何使用socat实现在MacOS上开启Docker Remote API的方式。
github有完整的解决方式地址

解决

  • 使用socat镜像开启服务
    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
  • 配置环境变量
    $vim ~/.bash_profile
    export DOCKER_HOST=tcp://localhost:2375
    $source .bash_profile
    
  • 确认
    curl localhost:2375/version

相关文章

网友评论

      本文标题:MAC Docker 开启远程连接服务

      本文链接:https://www.haomeiwen.com/subject/htvmtltx.html