Maciej Trzciński
Maciej Trzciński

Reputation: 181

Docker: Cannot start service app: OCI runtime create failed:

After update my Mac to the Catalina, unfortunately, I got Error:

ERROR: for app Cannot start service app: OCI runtime create failed: container_linux.go:345: starting container process caused "process_linux.go:430: container init caused \"rootfs_linux.go:58: mounting \\\"/Users/maciejtrzcinski/Sites/docker/openinvest/config/apache/.htaccess\\\" to rootfs \\\"/mnt/sda1/var/lib/docker/overlay2/a088def6294f3c190633026f8d28b68bc6a6eb5cbca33f2dcf7272d716a54ba5/merged\\\" at \\\"/mnt/sda1/var/lib/docker/overlay2/a088def6294f3c190633026f8d28b68bc6a6eb5cbca33f2dcf7272d716a54ba5/merged/var/www/html/.htaccess\\\" 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

YML file:

version: "3"

services:
  app:
    image: wordpress:5.1.1-php7.2
    depends_on:
      - mariadb
    env_file:
      - .env
    volumes:
      - ./log/apache2:/var/log/apache2
      - ./config/apache/.apache:/var/www/html/.apache
      - ./wp-content:/var/www/html/wp-content
    ports:
      - 80:80
  mariadb:
    image: mariadb:10
    volumes:
      - ./data/mariadb:/var/lib
    ports:
      - 3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: ${WORDPRESS_DB_PASSWORD}
      MYSQL_DATABASE: ${WORDPRESS_DB_NAME}
      MYSQL_USER: ${WORDPRESS_DB_USER}
      MYSQL_PASSWORD: ${WORDPRESS_DB_PASSWORD}

I'm trying with - ./config/apache/:/var/www/html/, but this also doesn't work. Anybody know maybe where is it the problem?

Upvotes: 7

Views: 14398

Answers (2)

Promise Preston
Promise Preston

Reputation: 29068

I had a similar issue when I was working on a Rails application on Ubuntu 18.04. I have the application setup with a Dockerfile and with docker-compose.yml.

Here's the error I was getting:

I had previously built the image(s) using docker-compose build, so I no longer run the docker-compose build again, however, when I run the command docker-compose up to start up the container(s), I get this error:

ERROR: for mailing_list_app_1 Cannot start service app: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"./entrypoints/rails-entrypoint.sh\": stat ./entrypoints/rails-entrypoint.sh: no such file or directory": unknown

ERROR: for app Cannot start service app: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"./entrypoints/rails-entrypoint.sh\": stat ./entrypoints/rails-entrypoint.sh: no such file or directory": unknown ERROR: Encountered errors while bringing up the project.

The issue was that I moved and renamed the file /entrypoints/rails-entrypoint.sh to docker/entrypoints/docker-entrypoint.sh.

So when I run the command docker-compose up to start up the container(s) it fails because it can no longer find the /entrypoints/rails-entrypoint.sh file.

Here's how I solved it:

Rebuild the image for the project by running the command. This copies the new file (docker/entrypoints/docker-entrypoint.sh) into the new image, and removes the link to the old file (/entrypoints/rails-entrypoint.sh):

docker-compose build

And then start up the container again using the newly built image:

docker-compose up

That's all.

I hope this helps

Upvotes: 0

Maciej Trzciński
Maciej Trzciński

Reputation: 181

I removed the old container and added a new one and works.

  1. docker-machine remove [old]
  2. docker-machine create [new]
  3. eval $(docker-machine env [new])
  4. docker-compose up

Upvotes: 2

Related Questions