Access Docker socket within container

前端 未结 3 1046
南笙
南笙 2020-11-30 07:23

I am attempting to create a container that can access the host docker remote API via the docker socket file (host machine - /var/run/docker.sock).

The answer here su

3条回答
  •  隐瞒了意图╮
    2020-11-30 08:14

    I figured it out. You can simply pass the the socket file through the volume argument

    docker run -v /var/run/docker.sock:/container/path/docker.sock
    

    As @zarathustra points out, this may not be the greatest idea however. See: https://www.lvh.io/posts/dont-expose-the-docker-socket-not-even-to-a-container.html

提交回复
热议问题