skip to Main Content

I’ve been trying docker-compose up -d to my container but causes this error below:

ERROR: for phpsample-feed_phpsample_1 Cannot start service phpsample: OCI runtime create failed:
container_linux.go:346: starting container process caused “process_linux.go:449: container init caused
“rootfs_linux.go:58: mounting \”/c/Users/testUser/Documents/phpsample-feed/src\” to rootfs
\”/mnt/sda1/var/lib/docker/overlay2/e6bf66b01f587c8826c2944b676044c6a199a0c8c2b8807adf13de0e0f8c4509/
merged\” at \”/mnt/sda1/var/lib/docker/overlay2/e6bf66b01f587c8826c2944b676044c6a199a0c8c2b8807adf13de0e0f8c4509/
merged/var/www/html\” 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

Here is my docker-compose.yml file:

version: '3.7'
services:
  phpsample:
    build:
      context: .
    init: true
    ports:
      - '8080:80'
    depends_on:
      - db
      - redis
    volumes:
      - ./src:/var/www/html:rw
    environment:
      - DB_HOST=db
      - DB_USR=user
      - DB_PW=test
      - DB_DBNAME=phpsample
      - DB_DBPREFIX=dev_
      - IS_SHORT_URL=1
      - CACHE_DRIVER=redis
      - CACHE_HOST=redis
      - CACHE_PORT=6379
      - CACHE_REDIS_DB=3
      - DEBUG=false
    restart: always
  db:
    image: mysql:8
    environment:
      - MYSQL_ROOT_PASSWORD=test
      - MYSQL_USER=user
      - MYSQL_PASSWORD=test
      - MYSQL_DATABASE=phpsample
    volumes:
      - db_data:/var/lib/msyql
    command: --default-authentication-plugin=mysql_native_password --sql_mode=NO_ENGINE_SUBSTITUTION
  redis:
    image: redis:5-buster
    init: true
    command: ["redis-server", "--appendonly", "yes"]
    volumes:
      - redis_data:/data
volumes:
  db_data:
  redis_data:

My system and tools used:

  • Windows 10 Home
  • Docker Toolbox Terminal
  • Kitematic
  • Oracle VM

I’ve also tried editing my Shared Folders on VM by doing this. With the settings below:

Name: c/Users Path: C:Users

2

Answers


  1. src should be a directory containing your web content, not a file.

    Login or Signup to reply.
  2. In docker-compose.yaml file make sure that input yaml file path is exist under volumes:

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search