Introduction
This is an article where the main focus is just to solve a specific problem. That specific problem contains error message. Furthermore, the error message appear upon the execution of a specific command. That specific command itself is the command where it has the connection with the ‘docker-compose’ command. So, there is a certain command for pulling images, building those images into Docker container and then run it. Below is the execution of the command :
C:\repository\production\website>docker-compose down services.wordpress.volumes must be a list C:\repository\production\website>
So, the error message in the above output command execution is because of a false configuration pattern exist in the ‘docker-compose.yml’ file. Before going on further, the following is the content of the ‘docker-compose.yml’ file :
version: '3' services: # Database db: image: mysql:5.7 volumes: - "./mysql:/var/lib/mysql" restart: always environment: MYSQL_ROOT_PASSWORD: password MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress networks: - wpsite # phpmyadmin phpmyadmin: depends_on: - db image: phpmyadmin/phpmyadmin restart: always ports: - '8080:80' environment: PMA_HOST: db MYSQL_ROOT_PASSWORD: password networks: - wpsite # WordPress wordpress: depends_on: - db image: wordpress:4.5.2 ports: - '80:80' restart: always volumes: "./html:/var/www/html" environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress networks: - wpsite networks: wpsite: volumes: db_data:
How to Solve Error Message services.service_name.volumes must be a list
In order to solve the problem context of the command above, the focus is to be able to correct the ‘docker-compose.yml’ file. Actually, the error message is appear in the previous part for the exact one is ‘services.wordpress.volumes’. So, in this context, the service_name in the above command execution triggering the error message is ‘wordpress’. Base on that, the exact error message will be :
services.wordpress.volumes must be a list
Because the error is in the ‘wordpress’ service, just focus on to that part. The following is the original part of it :
wordpress: depends_on: - db image: wordpress:4.5.2 ports: - '80:80' restart: always volumes: "./html:/var/www/html" environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress networks: - wpsite
After that, just focus on another detail part of the ‘wordpress’ part which is the ‘volumes’. So, the highlight of the ‘docker-compose.yml’ file exists in the following part :
volumes: "./:/var/www/html"
volumes: - "./html:/var/www/html"
So, the final revision of the ‘wordpress.volume’ part from the ‘docker-compose.yml’ file exist below :
wordpress: depends_on: - db image: wordpress:4.5.2 ports: - '80:80' restart: always volumes: - "./html:/var/www/html" environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress networks: - wpsite
Last but not least, just execute the ‘docker-compose’ command once more as follows :
C:\repository\production\website>docker-compose up -d [+] Running 4/4 - Network website-using-source_default Created 0.1s - Container website-using-source-db-1 Started 0.7s - Container website-using-source-www-1 Started 1.0s - Container website-using-source-phpmyadmin-1 Started 1.0s C:\repository\production\website>