In Docker, I'm attempting to connect to a Docker deamon (dind). To run dind and docker-client, I use docker-compose. When I use docker-client to connect to dind, it fails. It returns an error message. What is the best way to deal with this?
version: '3'
services:
docker:
# Starts a Docker daemon at the DNS name "docker"
# Note:
# * This must be called "docker" to line up with the default
# TLS certificate name
# * DOCKER_TLS_CERTDIR defaults to "/certs
image: docker:dind
privileged: yes
volumes:
- certs:/certs/client
docker-client:
# Provides a Docker client container, including the client
# certs generated by the docker:dind container, above.
# Notes:
# * The name of this container doesn't matter
# * The DOCKER_CERT_PATH defaults to /certs/client, the
# same path where the docker:dind image generates the
# client certificate (and that we've mounted inside this
# container).
# You can execute a shell inside this container by running:
# docker-compose exec docker-client sh
image: docker
command: sh -c 'while [ 1 ]; do sleep 1000; done'
environment:
DOCKER_HOST: tcp://docker:2376
volumes:
- certs:/certs/client
volumes:
certs: