I want to install in a dind container.
Here is my Dockerfile file:
FROM docker
RUN mkdir -p /src/
WORKDIR /src/
COPY docker-compose.yml /src/
COPY nginx /src/nginx/
COPY OSSMETADATA /src/
COPY web /src/web/
COPY docker-entrypoint.sh /src/
RUN chmod 755 /src/docker-entrypoint.sh
USER root
ENTRYPOINT ["./docker-entrypoint.sh"]
This is my entry script:
#!/bin/sh
apk add --no-cache py-pip
pip install docker-compose
docker-compose up
During execution of ‘docker-compose up’ I get the following error:
Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
Note that is I execute ‘docker-compose’ directly on my machine I do not encounter any issues.
as far as I know, you cannot do that… the docker daemon is running on the host, and does not run in a container.
if you have the right system you can ‘mount’ the docker socket (using -v), and issue a limited set of commands thru it, but this executes on the HOST os, not IN the container…
If you have a need to run Docker compose inside a Docker container, check out this new container runtime (aka runc) from Nestybox. It allows running Docker and Docker-Compose inside a Docker container, with total isolation from the host and without using privileged containers.