1

While I was trying to convert Docker compose file with the container transform I got the following error:

Container "container-name" is missing required parameter 'image'.

Services with the image parameter, it operates fine. However, the ones with the build parameter instead of the image cause error. I want to build some of the images based on a Dockerfile by using a build parameter and I don't need an image parameter in the Docker compose file at all. What would be the most effective solution here?

Here is an example:

Successfull transformation for db service:

Docker-compose.yml:

db:
 image: postgres

Dockerrun.aws.json:

 "containerDefinitions": [
        {
            "essential": true,
            "image": "postgres",
            "memory": 128,
            "mountPoints": [
                {
                    "containerPath": "/var/lib/postgresql/data/",
                    "sourceVolume": "Postgresql"
                }
            ],
            "name": "db"
        }

Unsuccessfull transformation for web service since build used instead of image parameter:

Docker-compose.yml:

web:
 build: 
  context: .
  dockerfile: Dockerfile
ikonuk
  • 575
  • 8
  • 19
  • It's not exactly clear what's the issue here, can you post a full dokcer-compose file which gives an error and the whole error message. – ruohola May 05 '20 at 19:44
  • @ruohola Error message is already in the question from container transform and I appended more details. – ikonuk May 05 '20 at 20:35

1 Answers1

1

The issue is that an AWS ECS (=elastic container service) task definition cannot depend on a Dockerfile to build the image. The image has to be already build for it to be used in a task definition. For this reason the "image" key is required in a task definition json file and so it has to be in the docker-compose file you are converting from also.

The image for the task definition can come from Docker hub (like the postgres image does) or you can build your own images and push them to AWS ECR (=elastic container registry).

ruohola
  • 21,987
  • 6
  • 62
  • 97