简体   繁体   中英

docker OCI runtime create failed

I'm using a following docker-compose file in a java web app project.

version: "3"
services:
  product:
    image: jboss/wildfly
    ports:
      - 8080:8080
    volumes:
      - Product/target/Product.war:/opt/jboss/wildfly/standalone/deployments

The error I'm getting is

ERROR: Named volume "Product/target/Product.war:/opt/jboss/wildfly/standalone/deployments:rw" is used in service "product" but no declaration was found in the volumes section.
Failed to deploy 'Compose: docker-compose.yml': `docker-compose` process finished with exit code 1

Edit OCI runtime create failed:

Following the fix of the path, I'm encountering another error. OCI runtime create failed:

Deploying 'Compose: docker-compose.yml'...
/usr/local/bin/docker-compose -f /Users/username/Desktop/Project/docker-compose.yml up -d
Starting project_product ... 
Starting project_product ... error
ERROR: for project_product  Cannot start service product: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:424: container init caused \"rootfs_linux.go:58: mounting \\\"/Users/username/Desktop/Project/User/target/Product.war\\\" to rootfs \\\"/var/lib/docker/overlay2/e090197e0697ec14446020cf2444dc0d3f39dfb240de9f399017415f6faeb13b/merged\\\" at \\\"/var/lib/docker/overlay2/e090197e0697ec14446020cf2444dc0d3f39dfb240de9f399017415f6faeb13b/merged/opt/jboss/wildfly/standalone/deployments\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

ERROR: for product  Cannot start service product: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:424: container init caused \"rootfs_linux.go:58: mounting \\\"/Users/username/Desktop/Project/User/target/Product.war\\\" to rootfs \\\"/var/lib/docker/overlay2/e090197e0697ec14446020cf2444dc0d3f39dfb240de9f399017415f6faeb13b/merged\\\" at \\\"/var/lib/docker/overlay2/e090197e0697ec14446020cf2444dc0d3f39dfb240de9f399017415f6faeb13b/merged/opt/jboss/wildfly/standalone/deployments\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.
Failed to deploy 'Compose: docker-compose.yml': `docker-compose` process finished with exit code 1

You must add . at the beginning or use an absolute path when mounting a local file into a container. Otherwise Docker will assume it's a named volume, as the error suggests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM