docker-compose upで「Cannot start service php-fpm: OCI runtime create failed: container_linux.go:346: starting container process caused “process_linux.go:449: container init caused “rootfs_linux.go:58: mounting…」とか出る場合の対処

Docker ツール

Windows10でdocker-compose upを実行したら以下のようなエラーが出ました。
対処法を書いていきます。

ERROR: for laradock_php-fpm_1  Cannot start service php-fpm: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/host_mnt/c/Users/xxxx/laradock/php-fpm/php7.3.ini\\\" to rootfs \\\"/var/lib/docker/overlay2/042b2d3a8065bff1cd4bc15916305c3077b150f7e31dd138def02d87e7d07fe6/merged\\\" at \\\"/var/lib/docker/overlay2/042b2d3a8065bff1cd4bc15916305c3077b150f7e31dd138def02d87e7d07fe6/merged/usr/local/etc/php/php.ini\\\" 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

実行環境

実行環境は以下。

>docker -v
Docker version 19.03.5, build 633a0ea

>docker-compose -v
docker-compose version 1.24.1, build 4667896b

ホストマシンはWindows10 Proです。

エラーの内容

実行したコマンドとエラーは以下。

>docker-compose up -d nginx mysql phpmyadmin workspace
Starting laradock_mysql_1            ... done
Starting laradock_docker-in-docker_1 ... done
Starting laradock_phpmyadmin_1       ... done
Starting laradock_workspace_1        ... done
Starting laradock_php-fpm_1          ... error
ERROR: for laradock_php-fpm_1  Cannot start service php-fpm: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/host_mnt/c/Users/xxxx/laradock/php-fpm/php7.3.ini\\\" to rootfs \\\"/var/lib/docker/overlay2/042b2d3a8065bff1cd4bc15916305c3077b150f7e31dd138def02d87e7d07fe6/merged\\\" at \\\"/var/lib/docker/overlay2/042b2d3a8065bff1cd4bc15916305c3077b150f7e31dd138def02d87e7d07fe6/merged/usr/local/etc/php/php.ini\\\" 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 php-fpm  Cannot start service php-fpm: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/host_mnt/c/Users/xxxx/laradock/php-fpm/php7.3.ini\\\" to rootfs \\\"/var/lib/docker/overlay2/042b2d3a8065bff1cd4bc15916305c3077b150f7e31dd138def02d87e7d07fe6/merged\\\" at \\\"/var/lib/docker/overlay2/042b2d3a8065bff1cd4bc15916305c3077b150f7e31dd138def02d87e7d07fe6/merged/usr/local/etc/php/php.ini\\\" 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.

コンテナの初期化に失敗しているようなのですが、原因がよくわかりません。
コンテナを削除して作り直したら解決するというネット情報を発見したので試します。

>docker-compose stop
Stopping laradock_phpmyadmin_1       ... done
Stopping laradock_workspace_1        ... done
Stopping laradock_mysql_1            ... done
Stopping laradock_docker-in-docker_1 ... done
>docker-compose rm
Going to remove laradock_nginx_1, laradock_php-fpm_1, laradock_phpmyadmin_1, laradock_workspace_1, laradock_mysql_1, laradock_docker-in-docker_1
Are you sure? [yN] y
Removing laradock_nginx_1            ... done
Removing laradock_php-fpm_1          ... done
Removing laradock_phpmyadmin_1       ... done
Removing laradock_workspace_1        ... done
Removing laradock_mysql_1            ... done
Removing laradock_docker-in-docker_1 ... done
>docker-compose up -d nginx mysql phpmyadmin workspace
Creating laradock_mysql_1            ... done
Creating laradock_docker-in-docker_1 ... done
Creating laradock_workspace_1        ... done
Creating laradock_phpmyadmin_1       ... done
Creating laradock_php-fpm_1          ... done                                                                                           Creating laradock_nginx_1            ... error                                                                                          
ERROR: for laradock_nginx_1  Cannot start service nginx: driver failed programming external connectivity on endpoint laradock_nginx_1 (78e19fb306741302c29f669963867b01b2d9ca33362d588319a4d3e58d5895dc): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

ERROR: for nginx  Cannot start service nginx: driver failed programming external connectivity on endpoint laradock_nginx_1 (78e19fb306741302c29f669963867b01b2d9ca33362d588319a4d3e58d5895dc): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
ERROR: Encountered errors while bringing up the project.

別のエラーが出てしまいましたが、コンテナの初期化でエラーになっていた部分は解消しました。

コンテナを削除して作り直すと直るようです。


以上となります。

コメント/ピンバック

タイトルとURLをコピーしました