Error running docker compose file:
ERROR: for yingxue_mysql_1 Cannot create container for service mysql: invalid volume specification: 'yingxue_data:var/lib/mysql:rw': invalid mount config for type "volume": invalid mount path: 'var/lib/mysql' mount path must be absolute
ERROR: for mysql Cannot create container for service mysql: invalid volume specification: 'yingxue_data:var/lib/mysql:rw': invalid mount config for type "volume": invalid mount path: 'var/lib/mysql' mount path must be absolute
ERROR: Encountered errors while bringing up the project.
Docker compose original file
version: "3.3"
networks:
yingxue_network:
volumes:
data:
services:
nacos:
image: nacos/nacos-server:2.0.2
ports:
- "8848:8848"
environment:
- "JVM_XMS=256m"
- "JVM_XMX=256m"
- "MODE=standalone"
networks:
- yingxue_network
mysql:
image: mysql:5.7
ports:
- "3306:3306"
networks:
- yingxue_network
volumes:
- data:var/lib/mysql
- ./yingxue.sql:/docker-entrypoint-initdb.d/yingxue.sql
environment:
- "MYSQL_ROOT_PASSWORD=root"
- "MYSQL_DATABASE=yingxue"
The problem description shows that the path is wrong. After careful inspection, it is found that the data volume data: var/lib/MySQL is missing /, which should be:
volumes:
- data:/var/lib/mysql
- ./yingxue.sql:/docker-entrypoint-initdb.d/yingxue.sql
Read More:
- [Solved] Bringing up interface eth0: Error: No suitable device found: no device found for connection ‘System eth0’.
- [Solved] docker Error: bridge docker0 failed: exchange full
- How to Fix ERROR Couldn’t connect to Docker daemon at http+docker://localunixsocket
- [Solved] CentOS build a docker error: job for docker.service failed….
- Eclipse start project error: Errors occurred during the build. Errors running builder ‘Integrated External Tool Builder’ on…
- [Solved] Errors encountered when using VS to write opengl code
- Run real machine Errors were encountered while preparing your device for development. Please check the Devices
- [Solved] Docker Error: driver failed programming external connectivity on endpoint
- [Solved] Docker Error: got permission denied while trying to connect to the docker daemon socket at…
- Docker service startup error: Job for docker.service failed because the control process exited with error code.
- The spring project is normal locally, and the bean cannot be found error is thrown when entering the docker container
- Some problems encountered in the initial construction of Ant Design Pro project, such as cross Env, webpack and so on
- Docker Open Error: Warning: docker.service changed on disk. Run ‘systemctl daemon-reload‘ to reload unit
- [Solved] docker: Error response from daemon: driver failed programming external connectivity on endpoint mysql-test …
- [Solved] Docker Start Error: iptables failed: iptables –wait -t nat -A DOCKER -p tcp -d 0/0 –dport 10241
- How to Fix the common Warning Errors after Vue Project Startup
- Docker Create or Start Nginx Error: docker: Error response from daemon: driver failed programming external connectivity
- [Solved] Docker: Error response from daemon: driver failed programming external connectivity on endpoint mysq
- Docker Error response from daemon: Get https://registry-1.docker.io/v2/portainer/portainer/…
- Vagrant up Error: Warning: Authentication failure. Retrying…[How to Solve]