I have a python server setup of multi containers with Dockerrun.aws.json file that picks up the images from ECR:
{
"AWSEBDockerrunVersion": 2,
"volumes": [
{
"host": {
"sourcePath": "API"
},
"name": "_Api"
}
],
"containerDefinitions": [
{
"essential": true,
"Update": true,
"memory": 128,
"name": "my_api",
"image": "xxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/my-api:test1",
"mountPoints": [
{
"containerPath": "/code",
"sourceVolume": "_Api"
}
]
},
{
"essential": true,
"memory": 128,
"name": "nginx",
"image": "xxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/dashboard-nginx:test1",
"portMappings": [
{
"containerPort": 80,
"hostPort": 80
}
],
"links": [
"my_api"
]
},
{
"essential": true,
"memory": 128,
"name": "redis",
"image": "redis:latest",
"portMappings": [
{
"containerPort": 6379,
"hostPort": 6379
}
]
}
]
I have done some modifications to the containers and wish to test it locally using the eb local run
command
But no matter what i do it is using original old images
I have a parallel docker-compose.yml i was using before EB - which works as expected:
version: '3'
services:
my_api:
image: xxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/my-api:test1
build: ./API
expose:
- "5555"
volumes:
- ./API:/code
depends_on:
- redis
redis:
image: redis:latest
networks:
- service
ports:
- "6379:6379"
expose:
- "6379"
nginx:
image: xxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/my-nginx:test1
build:
context: ./API
dockerfile: Dockerfile-nginx
ports:
- 80:80
depends_on:
- my_api
I tried to build and push with docker-compose . and with docker , with a new tag and more But still i get the same behavior
The .elasticbeanstalk/docker-compose.yml file seems to get updated , but even running docker-compose up --build with it still uses the older image
I tried running docker system prune -a to make eb pull the new tagged container - but still , somehow, i got the old images again
Even deploy to AWS acts the same
When i run the docker ps -a , i can see that the containers used are only different by their names but uses different image ids:
89b258852e84 xxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/my-nginx:test1 "nginx -g 'daemon of…" 9 minutes ago Exited (0) 5 minutes ago dashboard-nginx
23196d6e8016 xxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/my-api:test1 "uwsgi --ini app.ini" 9 minutes ago Exited (0) 5 minutes ago dashboard-api
95b4473bc38f redis:latest "docker-entrypoint.s…" 9 minutes ago Exited (0) 5 minutes ago live_dashboard_redis_1
32be5539e905 xxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/my-nginx:test1 "nginx -g 'daemon of…" 10 minutes ago Exited (0) 6 minutes ago elasticbeanstalk_nginx_1
51d89fcdfd94 redis:latest "docker-entrypoint.s…" 10 minutes ago Exited (0) 6 minutes ago elasticbeanstalk_redis_1
e10715455525 xxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/my-api:test1 "uwsgi --ini app.ini" 10 minutes ago Exited (0) 6 minutes ago elasticbeanstalk_myapi_1
What have i missed or did not fully understand ? is there any way to make eb local rebuild and use the latest images locally? Why is not EB pull the latest version of an Image when deploying ? Any help or suggestion would be greatly appreciated
EDIT1
Some more info i gathered when i inspect the docker-compose image and the eb one i can see they have a diffrent Mount section which can explain the code diffrences :
docker-compose
"Mounts": [
{
"Type": "bind",
"Source": "/host_mnt/c/Workspaces/PRJ/DevOps/Tools/proj/API",
"Destination": "/code",
"Mode": "rw",
"RW": true,
"Propagation": "rprivate"
}
]
eb:
"Mounts": [
{
"Type": "volume",
"Name": "API",
"Source": "/var/lib/docker/volumes/API/_data",
"Destination": "/code",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
}
]
strange as i am working on windows
After few days with AWS Support on the phone Finally we got an answer So if anyone face this in the future , you need to check your mount setup
Make the volume pick from /var/app/current/API
"volumes": [
{
"host": {
"sourcePath": "/var/app/current/API"
},
"name": "_Api"
}
],