Help us understand the problem. What is going on with this article?


More than 1 year has passed since last update.



docker-compose が WSL 上で立てた Docker で動かない



$ docker-compose up -d
Creating network "etl_default" with the default driver
ERROR: Failed to Setup IP tables: Unable to enable NAT rule:  (iptables failed: iptables --wait -t nat -I POSTROUTING -s {ip}/16 ! -o br-e9ec09beb9a3 -j MASQUERADE: iptables: No chain/target/match by that name.
 (exit status 1))

つらい(◞‸◟) Microsoftさんもうちょっと頑張って……。


WSL上のDockerがつらいので、Windows上のDockerにWSLから繋ぎます。(参考: Bash on Ubuntu on Windowsからdocker-machineにTLSで接続する(Hyper-V使用))

export DOCKER_HOST="tcp://"
export DOCKER_CERT_PATH="/mnt/c/Users/Kage/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
$ docker ps
CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS              PORTS                                      NAMES
fc27365a8322        *************_nginx   "nginx -g 'daemon ..."   4 minutes ago       Up 4 minutes>80/tcp,>443/tcp   *******_nginx
fdb099696d3c        *************_web     "docker-php-entryp..."   4 minutes ago       Up 4 minutes        9000/tcp                                   *******_web
85ca308d5037        memcached:1.4         "docker-entrypoint..."   4 minutes ago       Up 4 minutes        11211/tcp                                  *******_memcached
7ab615fffb35        postgres:latest       "docker-entrypoint..."   5 months ago        Up 19 minutes>5432/tcp                     chat-app-server_db_1
9b11b5a7fabc        adminer               " doc..."   5 months ago        Up 19 minutes>8080/tcp                     chat-app-server_adminer_1


> docker-compose up --build
Recreating dog_apache_1 ... done
Attaching to dog_apache_1
apache_1  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using Set the 'ServerName' directive globally to suppress this message
apache_1  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using Set the 'ServerName' directive globally to suppress this message
apache_1  | [Mon Dec 03 14:31:36.318825 2018] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.12 configured -- resuming normal operations
apache_1  | [Mon Dec 03 14:31:36.319066 2018] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
apache_1  | [Mon Dec 03 14:31:38.734628 2018] [autoindex:error] [pid 17] [client] AH01276: Cannot serve directory /var/www/html/dog/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive
apache_1  | - - [03/Dec/2018:14:31:38 +0000] "GET /dog/ HTTP/1.1" 403 510 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0"



ちなみに、Docker Quickstart Terminal上から叩くと上手く動きました。

Windows10 HomeではDocker for Windowsが使えない

Hyper-VがWindows10 Proでないと使えないのでDocker Toolboxを使ってVirtualBox上に立てることになります。



$ docker-compose up --build
Creating *************_mysql_1       ... done
Creating *******_web ... done
Creating *******_nginx ... done
Creating *******_memcached ...
Creating *************_mysql_1       ...
Creating *******_supervisord ...
Creating *******_web ...
Creating *******_nginx ...
Attaching to *************_data_1, *******_memcached, *************_mysql_1, *******_supervisord, *******_web, *******_nginx
mysql_1        | Initializing database
*******_supervisord | /usr/lib/python2.7/dist-packages/supervisor/ UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
*******_supervisord |   'Supervisord is running as root and it is searching '
*******_web    | [03-Dec-2018 12:08:56] NOTICE: fpm is running, pid 1
*******_supervisord | Error: The directory named as part of the path /var/www/html/application/logs/supervisor.log does not exist.
*******_supervisord | For help, use /usr/bin/supervisord -h
*************_data_1 exited with code 0
*******_supervisord exited with code 2
mysql_1        | 2018-12-03T12:08:55.567590Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
mysql_1        | 2018-12-03T12:08:55.585417Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
mysql_1        | 2018-12-03T12:08:56.585219Z 0 [ERROR] InnoDB: Operating system error number 22 in a file operation.
mysql_1        | 2018-12-03T12:08:56.585462Z 0 [ERROR] InnoDB: Error number 22 means 'Invalid argument'
mysql_1        | 2018-12-03T12:08:56.585741Z 0 [ERROR] InnoDB: File ./ib_logfile101: 'aio write' returned OS error 122. Cannot continue operation
mysql_1        | 2018-12-03T12:08:56.585876Z 0 [ERROR] InnoDB: Cannot continue operation.
*************_mysql_1 exited with code 3

いろいろ試しましたがこればかりはどうしようもなかったです。つらい( ˘•ω•˘ )


素直に Ubuntu と Windows のデュアルブートにしました。しあわせ

Twitter アカウント管理サービス「SocailDog」を開発・運営するスタートアップ
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away