Reputation: 9443
My knowledge to docker is pretty limited so I came here posting this celery worker service won't start with the following error:
ERROR: for api_worker_1 Cannot start service worker: b'OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"worker\": executable file not found in $PATH": unknown'
DockerFile
# web
FROM python:2.7
RUN apt-get update
RUN apt-get install -y swig
RUN apt-get install -y libssl1.0-dev
RUN pip install --upgrade pip
ADD . /app
WORKDIR /app
CMD ["python", "-u","app.py"]
docker-compose.yml
version: '2'
services:
db:
image: postgres
restart: always
volumes:
- ./postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
web:
restart: always
build: .
volumes:
- ./web:/data/web
- .:/app
command: python -u app.py
ports:
- "5000:5000"
rabbit:
hostname: rabbit
image: rabbitmq:latest
environment:
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
ports:
- "5672:5672"
worker:
restart: always
build: .
volumes:
- .:/app
command: celery worker -B -l info -A app.tasks.celery
links:
- db
- rabbit
- web
depends_on:
- web
Looking at the worker service:
worker:
restart: always
build: .
volumes:
- .:/app
command: celery worker -B -l info -A app.tasks.celery
I'm not using/installing the celery from docker. As this is rather a worker image instead of celery image.
This is running with flask application and it was recently working. After cleaning up or deleting images and containers. Running docker-compose build
and docker-compose up
yield the
OCI runtime create failed:..
Error afterward.
UPDATE
I updated the title of the question because celery title is misleading here. This is rather a worker service which doesn't have a DockerFile
on it. It is a service to start a celery worker which resides on app/tasks/celery
.
Upvotes: 5
Views: 10185
Reputation: 2115
In your docker-compose file, you have specified the same build context (build: .
) for both web
and worker
. The Dockerfile
you posted above is being used to build the web
image AND the worker
image, and clearly celery
is not installed in that image.
Upvotes: 2