How to Solve Error Message services.db Additional property images is not allowed when running ‘docker-compose build’ Command in Microsoft Windows

Posted on

Introduction

Another article for showing how to solve or to handle a specific error message. The error message appear when there is an execution of one single command. In this article, that command is the ‘docker-compose build’ command. Moreover, the execution of the command is in a local device with Microsoft Windows as the operating system. There is a ‘docker-compose.yml’ file in the folder where the execution of the command takes place. Below is the execution of that command :

C:\repository\docker\docker-image-build-with-docker-compose>docker-compose build
services.db Additional property images is not allowed

C:\repository\docker\docker-image-build-with-docker-compose>

For a reference, the following is the actual content of the ‘docker-compose.yml’ file :

version: '3.3'
services: 
  db:
    images: mysql

In the error appear before, it is clearly informing the fault of the above definition of the docker file. It is the part ‘services.db Additional property images is not allowed’. So, in this case, the ‘images’ property is not allowed for ‘services.db’.

How to Solve Error Message Additional property is not allowed

In this part, it will focus on how to solve the problem appear in the previous part. The problem exist because of the failure of a certain command execution. In the failure of the command execution of ‘docker-compose build’, there is an output after. The output is actually an error message informing why the command execution end in a failure. Since it is obvious that the property images is not allowed, just check the correct property to define the image for the service. Actually, there is a page which is giving the information about the compose file for Docker. Just visit the page in this link.That page is a documentation page of compose file for Docker.

According to the page, there is no property or attribute with the name ‘images’ for ‘services’ key component or ‘services’ definition. On the other hand, there is another property or attribute with similar context. That property or attribute is ‘image’. In the compose file for Docker’s documentation page in this link, the ‘image’ property or attribute exist with a description. The description for the ‘image’ property or attribute is specify the image to start the container from. Can either be a repository/tag or a partial image ID.

In order to solve it, just change the above content of the ‘docker-compose.yml’ file into the following revision :

version: '3.3'
services: 
  db:
    image: mysql

Finally, run the command once more. If there are no more error messages appear, it will be as in the following execution :

C:\repository\docker\docker-image-build-with-docker-compose>docker-compose build

C:\repository\docker\docker-image-build-with-docker-compose>

Although it does not have any output at all, at least the error message is no longer exist.

Leave a Reply