I want Elastic Beanstalk to call my docker-compose file when running the EC2 instance in order to spin up redis within the docker container. It is not doing so. When I run the docker-compose file using a script outside of AWS my application runs just fine. I have looked at the documentation on AWS and there isn’t a clear answer on how EB is actually finding my docker compose file. I would love to ask anyone with a bit more experience for advice on how to remedy this.
docker-compose
version: '3'
services:
web:
image: filamentgraphql/filament-prod
container_name: 'filament-prod-hot'
ports:
- '4000:4000'
volumes:
- .:/usr/src/app
command: npm run build
redis-server:
image: 'redis'
volumes:
- "./data/redis:/usr/src/app/data"
Dockerfile
FROM node:12.16.1
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN npm install
RUN npm run build
EXPOSE 4000
ENTRYPOINT node ./server/server.js
2
Answers
I think the options are explosive as I read the AWS docs:
If you want to keep using
Dockerfile
for yourdocker-compose.yml
, rename it or place it in some subfolder so that EB does not find theDockerfile
this will work
…but it will rebuild your docker container twice. To get around this may as well rename your
Dockerfile
toDockerfile-aws
and do