I’ve developed a Java application with Spring Boot that utilizes Docker to run Python scripts within containers. My development environment is working fine, but I’m encountering an issue when attempting to deploy my application to production on Render.
Here’s the error I’m facing:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Additional Details:
I’m using Docker version 20.10.7, installed on an Ubuntu 20.04 machine.
My Spring Boot application is built with Java 17.
I’ve configured my Dockerfile to install Docker, Java, Python, and other necessary dependencies.
I’m using Docker Compose to orchestrate my application along with a PostgreSQL service.
In my Docker Compose file, I’ve mounted the /var/run/docker.sock volume to allow my application to interact with the host’s Docker daemon.
I should note that I’m restricted to using the free version of Docker due to budget constraints.
Despite these attempts, the issue persists. How can I resolve this problem of connecting to the Docker daemon in my development environment?
`version: ‘3’
services:
app:
image: code_stream_backend:tag
build:
context: .
dockerfile: Dockerfile
ports:
– “8080:8080”
restart: always
depends_on:
– db
environment:
– spring.datasource.url=
– spring.datasource.username=
– spring.datasource.password=
volumes:
– /var/run/docker.sock:/var/run/docker.sock
– ./data:/data
db:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: monmotdepasse
POSTGRES_DB: votre_base_de_donnees
ports:
– “5432:5432″`
`FROM ubuntu:latest
RUN apt-get update &&
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add – &&
add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable” &&
apt-get update &&
apt-get install -y docker-ce docker-ce-cli containerd.io
RUN apt-get install -y openjdk-17-jdk
RUN apt-get install -y python3 python3-pip
RUN apt-get install -y curl wget vim
RUN mkdir /data
WORKDIR /app
COPY target/CodeStream-0.0.1-SNAPSHOT.jar /app/app.jar
EXPOSE 8080
CMD [“java”, “-jar”, “app.jar”]`
Thank you for your assistance
user25571445 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.