Elastic Beanstalk Docker Platform Build Bug from wrong docker compose command

0

Hi, I was tried to use latest version of 3.6 for Elastic Beanstalk Docker platform. I had tried 3.5.9 before and everything is ok. But on 3.6 there is a buggy command which is "/bin/sh -c docker compose pull". This command have changed on Docker Compose v2.20.

The main thing is we can set custom image name for custom images which is build from DockerFile. Here is an example;

version: "3.8"

services:
  backend:
    build: .
    container_name: foo
    image: foo

With this command, the created docker image is named as foo. With docker compose pull command, docker tries to pull images remotely. But because of DockerFile there is nothing to pull from remotely. Before v2.20 docker compose was not raised an error for this but not it raises an error and this causes elastic beanstalk build failure.

I have searched this issue and I found there is a new parameter added to docker compose for this issue. --ignore-buildable parameter should added to docker compose pull command.

Here is the related issue from docker compose github page: https://github.com/docker/compose/issues/8805

Please solve this bug on new platform version.

Omer
asked 9 months ago501 views
2 Answers
0

Firstly, I have tested the issue by creating an environment with same platform version as "Docker running on 64bit Amazon Linux 2/3.6.0" and deployed my sample Dockerfile and docker-compose.yml as follows:

Dockerfile:

FROM php:7.1-fpm 

docker-compose.yml:

version: "3.8"
services:
  mysql:
    image: mysql:5.7
    ports:
      - 3307:3306
  app:
    build:
      context: .
      dockerfile: Dockerfile

I noticed that in my case deployment went successful without any errors and while checking eb-engine.log log file, I found that beanstalk is able to pull the image from Dockerfile.

Here is the logs(eb-engine.log) snippet:

2023/08/11 10:59:47.460031 [INFO] start build docker app
2023/08/11 10:59:47.460033 [INFO] detected new app as docker compose app
2023/08/11 10:59:47.460044 [INFO] Running command /bin/sh -c docker compose config
2023/08/11 10:59:47.557229 [INFO] Running command /bin/sh -c docker compose config --services
2023/08/11 10:59:47.639964 [INFO] app
mysql

2023/08/11 10:59:47.640134 [INFO] fetching image names from Dockerfile /var/app/staging/Dockerfile
2023/08/11 10:59:47.640175 [INFO] found images [php:7.1-fpm] in Dockerfile /var/app/staging/Dockerfile
2023/08/11 10:59:47.640196 [INFO] Running command /bin/sh -c docker compose pull
2023/08/11 10:59:49.553576 [INFO]  app Skipped - No image to be pulled
 mysql Pulling
 mysql Pulled

2023/08/11 10:59:49.553614 [INFO] successfully execute command: docker compose pull

Moreover, I even read and tested about the "--ignore-buildable" option and I found that it uses when you want to "Ignore images that can be built".

$ sudo docker compose pull --ignore-buildable
[+] Pulling 2/2
 ✔ app Skipped - No image to be pulled                                                                                       0.0s 
 ✔ mysql Pulled

Further, in order to understand the issue better, we would need to look at your Dockerfile, docker-compose.yml and full logs of the environment. Hence, I kindly request you to please open a Premium Support case with us and share the above mentioned information along with reproduce steps, so that we will try to replicate and investigate the unusual behaviour observed. That said, sharing the above information in a public form is not a security best practice and highly not recommended. I appreciate your understanding here.

Thank you and have a good day ahead

AWS
SUPPORT ENGINEER
answered 9 months ago
  • I'm afraid your test is missed the important thing. I have tried to specify that i tried to use custom image name. And the bug is happened with custom image naming. In your docker-compose file you are not added image name, here is an edited docker-compose file from your example;

    version: "3.8"
    services:
      mysql:
        image: mysql:5.7
        ports:
          - 3307:3306
      app:
        image: app
        build:
          context: .
          dockerfile: Dockerfile
    

    I believe this is not a specific bug for my case, therefor my dockerfile will not relevant for this issue.

    Please try with this config and let me know is there any bug.

0

I have also tried with custom image config as you requested, I deploy the edited docker-compose file to my docker 3.6.0 environment and it deployed successfully.

Here is the application source bundle structure:

 $ tree -a
├── Dockerfile
└── docker-compose.yml

Dockerfile:

$ cat Dockerfile 
FROM php:7.1-fpm 

Edited docker-compose.yml file:

$ cat docker-compose.yml 
version: "3.8"
services:
  mysql:
    image: mysql:5.7
    ports:
      - 3307:3306
  app:
    image: app
    build:
      context: .
      dockerfile: Dockerfile

While checking the logs, I found that it successfully build the image as I can see the following output in the logs.

eb-engine.log:

2023/08/14 02:19:26.127179 [INFO] Running command /bin/sh -c docker compose pull
2023/08/14 02:19:49.818889 [INFO]  mysql Pulling 
 app Pulling 
648e0aadf75a Pulling fs layer 
 318af44fe185 Pulling fs layer 
d9eb75e2f2e Downloading [>                                                  ]  540.7kB/104.3MB
 318af44fe185 Downloading [==================================================>]     224B/224B
 318af44fe185 Verifying Checksum 
 ed9eb75e2f2e Extracting [=========================================>         ]  86.34MB/104.3MB
 3e282e7651b1 Extracting [==============>                                    ]  294.9kB/983.7kB
6eb790cf6382 Pull complete 
 b4b277ff2929 Extracting [==================================================>]     333B/333B
 7db4c6dd7c72 Pull complete 
app Pulled 
 66cc05a182b5 Pull complete 
 mysql Pulled 
2023/08/14 02:19:49.819153 [INFO] successfully execute command: docker compose pull
AWS
SUPPORT ENGINEER
answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions