Reputation: 1
the context of my problem is:
I have a test routine in python, which start some containers, in order to run required services on background. So, when I run "pytest", it runs a "docker-compose up -d" command.
But I have a demand to running this test routine on a CI (tekton specifically). In order to do that, I started to write a Dockerfile, which contains python as base image, and docker/docker-compose installed as dependency. I created a volume to share docker socket between my machine and docker image, and it works fine. I run docker-compose on my container, which starts my required services on background, but my test failed with timeout. After some debugging, I realized those services are unreachable on my container, even if it appears on "docker ps" command. Also, I can reach those services on my local machine.
Does anyone know what could be happening?
FROM python:3.11.1
RUN apt-get update && apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release \
software-properties-common
RUN apt-get install -y docker.io
RUN curl -L -o docker-compose https://github.com/docker/compose/releases/download/v2.27.0/docker-compose-$(uname -s)-$(uname -m) \
&& cp ./docker-compose /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose
VOLUME /var/run/docker.sock
COPY . /app
WORKDIR /app
# Only to check if volume exists
CMD ["ls", "-l", "/var/run/docker.sock"]
I tried to grant permissions using chmod, but nothing happenned Also, running the pytest code on my local machine, works with the services running inside container (because docker socket was shared) the same command to test if the service running on background works on my machine, but doesn`t work inside container
Upvotes: 0
Views: 29