cuscode
cuscode

Reputation: 75

docker-compose up --build becomes very slow using cloud docker-machine

docker-compose up --build becomes very slow using cloud docker-machine and after one hour i have and error of a not found entrypoint.sh file.

On local Mac docker-machine same config work fine.

My docker file

FROM python:3.5.2
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD app/ /code/
ADD static/ /code/
ADD entrypoint.sh /code/

my docker compose

version: '3.7'
services:
  web:
    build: .
    command: gunicorn --bind 0.0.0.0:8000 app.wsgi
    volumes:
      - .:/code
    entrypoint: ./entrypoint.sh
    expose:
      - "80"
  nginx:
    image: nginx:1.15.5
    restart: always
    ports:
      - "80:80"
    volumes:
      - ./static:/static
    depends_on:
      - web

commands I run

cd myprojectfolder
eval $(docker-machine env [my-cloud-machine-name])
docker-compose -f docker-compose.yml -f envs/prd/prd.yml up --build -d

error i have after one hour (my project files are only 40mb)
ERROR: for web Cannot start service web: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"./entrypoint.sh\": stat ./entrypoint.sh: no such file or directory": unknown ERROR: compose.cli.main.main: Encountered errors while bringing up the project.
Please help me Thanks

I changed as suggested to this configuration but nothing changed. I'm stuck on this:

docker.api.build._set_auth_headers: Sending auth config ()

this is my new config

docker compose

version: '3.7'

services:
  web:
    command: gunicorn --bind 0.0.0.0:8000 app.wsgi
    entrypoint: ./entrypoint.sh
    expose:
      - "80"

  nginx:
    image: nginx:1.15.5
    restart: always
    ports:
      - "80:80"
    volumes:
      - ./static:/static
    depends_on:
      - web

my prd.yml file

version: '3.7'

services:
  web:
    build:
      context: .
      dockerfile: ./envs/prd/Dockerfile

  nginx:
    volumes:
      - ./envs/prd/nginx/nginx.conf /etc/nginx/nginx.conf

my prd dockerfile

FROM python:3.5.2
ENV PYTHONUNBUFFERED 1
WORKDIR /
ADD requirements.txt .
RUN pip install -r requirements.txt
ADD app/ ./app
ADD static/ ./static
ADD envs/prd/settings.py /app/settings.py
ADD entrypoint.sh .

my .dockerignore

.DS_Store
.dockerignore
.git/
.gitignore
README.rst
README.md
*.pyc
__pycache__
.idea/*

Upvotes: 1

Views: 2422

Answers (1)

S..
S..

Reputation: 5758

Remove the volume declarations from your docker-compose and instead copy all relevant files in during the build stage (in your Dockerfile). For example in your web service remove volumes: .:/code and add COPY * /code to its Dockerfile.

Upvotes: 1

Related Questions