Devilbox: localhost on Windows 10 not found

Created on 30 Nov 2016  路  24Comments  路  Source: cytopia/devilbox

If you encounter a bug and something does not work, make sure you have done the following and check those boxes before submitting an issue - thank you!

  • [x] Pull latest dockers (e.g.: docker pull cytopia/<used_docker>) before running docker-compose up
  • [x] Specify used docker versions (php, web and database)
  • [x] Attach logs for php, mysql and webserver (found in log/ directory)
  • [x] Start with debug mode and attach docker-compose output (.env setting DEBUG_COMPOSE_ENTRYPOINT=1)
  • [x] Never use different mysql|mariadb versions on the same HOST_PATH_TO_MYSQL_DATADIR on existing database files. Different mysql|mariadb versions might upgrade/corrupt existing database files. If you have done that already, start with a different path of HOST_PATH_TO_MYSQL_DATADIR (to an empty directory) and try again.

Please also specify the following info:

  • [Windows 10] Which operating system are you at (Linux, OSX or Windows)
  • [1.12.0] docker version
  • [1.8.0] docker-compose version

Hi, nice job. It works flawless under Debian (VirtualBox on Windows), but does not work on Windows Host with Docker-Machine.

In Webbrowser (Chrome, Firefox, Edge): "http://localhost can not be found".

Maybe I am missing something?

bug virtualbox (docker-toolbox) waiting for reply

All 24 comments

Does docker compose start up successfully?
Could you paste the full docker-compose up output here?

  • Maybe windows has problems with the paths / instead of \ inside the config files?
  • Or maybe something with the built-in windows firewall?

Hi. Yes it starts successfully. Images are build.

Normally there are no problems with backslashes. Folder are created. Data-Folder has postgres and mysql-folder and files in it.

Output:

$ docker-compose.exe up
Starting devilboxmagento_mysql_1
Starting devilboxmagento_postgres_1
Starting devilboxmagento_php_1
Starting devilboxmagento_httpd_1
Attaching to devilboxmagento_postgres_1, devilboxmagento_mysql_1, devilboxmagento_php_1, devilboxmagento_httpd_1
postgres_1  | The files belonging to this database system will be owned by user "postgres".
postgres_1  | This user must also own the server process.
postgres_1  |
mysql_1     | [INFO] Setting docker timezone to: Europe/Berlin
postgres_1  | The database cluster will be initialized with locale "en_US.utf8".
mysql_1     | root $ rm /etc/localtime
postgres_1  | The default database encoding has accordingly been set to "UTF8".
php_1       | [INFO] Setting docker timezone to: Europe/Berlin
mysql_1     | root $ ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
php_1       | root $ rm /etc/localtime
postgres_1  | The default text search configuration will be set to "english".
mysql_1     | [INFO] Docker date set to: Thu Dec  1 00:05:22 CET 2016
postgres_1  |
php_1       | root $ ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
mysql_1     | [INFO] Setting MySQL: [mysqld] general-log=1
postgres_1  | Data page checksums are disabled.
php_1       | [INFO] Setting PHP: timezone=Europe/Berlin
mysql_1     | root $ sed -i'' 's|\[mysqld\]|\[mysqld\]
postgres_1  |
mysql_1     | general-log = 1|g' /etc/mysql/docker-default.d/logging.cnf
php_1       | root $ sed -i'' 's|;*date.timezone[[:space:]]*=.*$|date.timezone = Europe/Berlin|g' /etc/php.ini
mysql_1     | [INFO] Setting MySQL: [client] socket=/tmp/mysql/mysqld.sock
php_1       | [INFO] Docker date set to: Thu Dec  1 00:05:22 CET 2016
postgres_1  | fixing permissions on existing directory /var/lib/postgresql/data/pgdata ... ok
mysql_1     | root $ sed -i'' 's|\[client\]|\[client\]
httpd_1     | [INFO] Setting docker timezone to: Europe/Berlin
php_1       | [INFO] Adding custom configuration files:
mysql_1     | socket = /tmp/mysql/mysqld.sock|g' /etc/mysql/docker-default.d/socket.cnf
postgres_1  | creating subdirectories ... ok
php_1       | root $ find /etc/php-custom.d -type f -iname "*.ini" -exec echo "Copying: {} to /etc/php.d/" \; -exec cp "{}" /etc/php.d/ \;
mysql_1     | [INFO] Setting MySQL: [mysql] socket=/tmp/mysql/mysqld.sock
php_1       | [INFO] Setting PHP: xdebug.remote_enable=1
mysql_1     | root $ sed -i'' 's|\[mysql\]|\[mysql\]
httpd_1     | apache $ sudo rm /etc/localtime
postgres_1  | selecting default max_connections ... 100
php_1       | root $ echo 'xdebug.remote_enable=1' >> /etc/php.d/15-xdebug.ini
mysql_1     | socket = /tmp/mysql/mysqld.sock|g' /etc/mysql/docker-default.d/socket.cnf
postgres_1  | selecting default shared_buffers ... 128MB
php_1       | [INFO] Setting PHP: xdebug.remote_connect_back=0
mysql_1     | [INFO] Setting MySQL: [mysqld] socket=/tmp/mysql/mysqld.sock
mysql_1     | root $ sed -i'' 's|\[mysqld\]|\[mysqld\]
postgres_1  | selecting dynamic shared memory implementation ... posix
php_1       | root $ echo 'xdebug.remote_connect_back=0' >> /etc/php.d/15-xdebug.ini
mysql_1     | socket = /tmp/mysql/mysqld.sock|g' /etc/mysql/docker-default.d/socket.cnf
php_1       | [INFO] Setting PHP: xdebug.remote_port=9000
mysql_1     | root $ chown mysql:mysql /tmp/mysql
php_1       | root $ echo 'xdebug.remote_port=9000' >> /etc/php.d/15-xdebug.ini
mysql_1     | root $ chmod 777 /tmp/mysql
php_1       | [INFO] Setting PHP: xdebug.remote_host=172.20.10.2
mysql_1     | [INFO] Found existing data directory. MySQL already setup.
php_1       | root $ echo 'xdebug.remote_host=172.20.10.2' >> /etc/php.d/15-xdebug.ini
mysql_1     | [INFO] Starting mysqld  Ver 5.7.16 for Linux on x86_64 (MySQL Community Server (GPL))
php_1       | [INFO] Setting PHP: xdebug.remote_log="/var/log/php-fpm/xdebug.log"
mysql_1     | root $ mysqld
php_1       | root $ echo 'xdebug.remote_log="/var/log/php-fpm/xdebug.log"' >> /etc/php.d/15-xdebug.ini
php_1       | [INFO] Forwarding 172.16.238.12:3306 to 127.0.0.1:3306 inside this docker.
php_1       | root $ /usr/bin/socat tcp-listen:3306,reuseaddr,fork tcp:172.16.238.12:3306 &
php_1       | [INFO] Setting MySQL client config: socket=/tmp/mysql/mysqld.sock
php_1       | root $ echo '[client]'                                          > /etc/my.cnf
php_1       | root $ echo 'socket = /tmp/mysql/mysqld.sock'      >> /etc/my.cnf
php_1       | root $ echo '[mysql]'                                              >> /etc/my.cnf
php_1       | root $ echo 'socket = /tmp/mysql/mysqld.sock'      >> /etc/my.cnf
php_1       | [INFO] Setting PHP: mysql.default_socket=/tmp/mysql/mysqld.sock
php_1       | root $ sed -i'' 's|mysql.default_socket.*$|mysql.default_socket = /tmp/mysql/mysqld.sock|g' /etc/php.ini
php_1       | [INFO] Setting PHP: mysqli.default_socket=/tmp/mysql/mysqld.sock
httpd_1     | apache $ sudo ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
php_1       | root $ sed -i'' 's|mysqli.default_socket.*$|mysqli.default_socket = /tmp/mysql/mysqld.sock|g' /etc/php.ini
httpd_1     | [INFO] Docker date set to: Thu Dec  1 00:05:22 CET 2016
httpd_1     | [INFO] Enabling PHP-FPM at: 172.16.238.11:9000
php_1       | [INFO] Setting PHP: pdo_mysql.default_socket=/tmp/mysql/mysqld.sock
php_1       | root $ sed -i'' 's|pdo_mysql.default_socket.*$|pdo_mysql.default_socket = /tmp/mysql/mysqld.sock|g' /etc/php.ini
httpd_1     | apache $ sudo echo '#### PHP-FPM config ####' > /etc/httpd/conf.d/php-fpm.conf
httpd_1     | apache $ sudo echo '' >> /etc/httpd/conf.d/php-fpm.conf
httpd_1     | apache $ sudo echo '# enablereuse' >> /etc/httpd/conf.d/php-fpm.conf
php_1       | [INFO] Enabling sending of emails.
httpd_1     | apache $ sudo echo '# Defining a worker will improve performance' >> /etc/httpd/conf.d/php-fpm.conf
httpd_1     | apache $ sudo echo '# And in this case, re-use the worker (dependent on support from the fcgi application)' >> /etc/httpd/conf.d/php-fpm.conf
php_1       | root $ chmod 664 /var/mail/mailtrap
httpd_1     | apache $ sudo echo '# If you have enough idle workers, this would only improve the performance marginally' >> /etc/httpd/conf.d/php-fpm.conf
php_1       | root $ echo 'virtual_alias_maps = pcre:/etc/postfix/virtual' >> /etc/postfix/main.cf
php_1       | root $ echo '/.*@.*/ mailtrap' >> /etc/postfix/virtual
httpd_1     | apache $ sudo echo '#' >> /etc/httpd/conf.d/php-fpm.conf
php_1       | root $ newaliases
httpd_1     | apache $ sudo echo '# enablereuse requires Apache 2.4.11 or later' >> /etc/httpd/conf.d/php-fpm.conf
httpd_1     | apache $ sudo echo '#<Proxy "fcgi://172.16.238.11:9000/" enablereuse=on max=10></Proxy>' >> /etc/httpd/conf.d/php-fpm.conf
httpd_1     | apache $ sudo echo '<FilesMatch "\.php$">' >> /etc/httpd/conf.d/php-fpm.conf
httpd_1     | apache $ sudo echo '    Require all granted' >> /etc/httpd/conf.d/php-fpm.conf
httpd_1     | apache $ sudo echo '    # Pick one of the following approaches' >> /etc/httpd/conf.d/php-fpm.conf
httpd_1     | apache $ sudo echo '    # Use the standard TCP socket' >> /etc/httpd/conf.d/php-fpm.conf
httpd_1     | apache $ sudo echo '    SetHandler "proxy:fcgi://172.16.238.11:9000"' >> /etc/httpd/conf.d/php-fpm.conf
httpd_1     | apache $ sudo echo '    # If your version of httpd is 2.4.9 or newer (or has the back-ported feature), you can use the unix domain socket' >> /etc/httpd/conf.d/php-fpm.conf
httpd_1     | apache $ sudo echo '    #SetHandler "proxy:unix:/path/to/app.sock|fcgi://localhost/:9000"' >> /etc/httpd/conf.d/php-fpm.conf
httpd_1     | apache $ sudo echo '</FilesMatch>' >> /etc/httpd/conf.d/php-fpm.conf
httpd_1     | [INFO] Adding custom include directory: /etc/apache-2.4
httpd_1     | apache $ sudo sed -i'' 's|^IncludeOptional[[:space:]]*conf\.d/.*$|IncludeOptional /etc/apache-2.4/*.conf|g' /etc/httpd/conf/httpd.conf
httpd_1     | [INFO] Starting Server version: Apache/2.4.6 (CentOS)
httpd_1     | apache $ sudo /usr/sbin/httpd -DFOREGROUND
httpd_1     | httpd (pid 82) already running
postgres_1  | creating configuration files ... ok
devilboxmagento_httpd_1 exited with code 0
postgres_1  | running bootstrap script ... LOG:  could not link file "pg_xlog/xlogtemp.21" to "pg_xlog/000000010000000000000001": Operation not permitted
postgres_1  | FATAL:  could not open file "pg_xlog/000000010000000000000001": No such file or directory
postgres_1  | child process exited with exit code 1
postgres_1  | initdb: removing contents of data directory "/var/lib/postgresql/data/pgdata"
devilboxmagento_postgres_1 exited with code 1
php_1       | root $ postfix start
php_1       | [INFO] Starting PHP 5.6.28 (fpm-fcgi) (built: Nov  9 2016 07:15:35)
php_1       | root $ /usr/sbin/php-fpm -F
devilboxmagento_mysql_1 exited with code 1


On Windows, docker-machine uses ip 192.168.99.100. Maybe that's a problem?

The solution for Windows could be something like to have a variable in .env, where i can change 127.0.0.1 to 192.168.99.100.
After editing that in the docker-compose.yml, the box is working on 192.168.99.100. But the MySQL and Postgres-Container exit directly after startup. So are not running.

From you log I can see that httpd, postgres and mysql have exited abnormally (last ~10 lines).

As you already have postgresql included, which is only present in the latest master branch, please switch to the last stable git tag.

There was another Windows ticket in the past, maybe there are some useful information for you as well:

https://github.com/cytopia/devilbox/issues/18

I am using the latest. Started this project yesterday. That's right. mysql and postgres exit directly after starting.

Actually there are some differences on Windows Hosts, as I see it. Problems with:

  • Socket-Dir on Host
  • localhost IP is only working on Linux or OS Machines. On Windows it is192.168.99.100. (Maybe you should create a switch in .env for the IP Adress).

How I get the MYSQL-Container up, change in docker-compose.yml:

  • change 127.0.0.1 to 192.168.99.100
  • comment out the MySQL Socket Directory (in php and mysql section)

Now I can access MySQL under 192.168.99.100:3306. But the Socket is shown broken in devilbox backend, also I managed to connect to mysql-container via php as well. So far by now.

devilbox-my-sql-socket-error

Update on Postgres:

There seems to be file-permission errors as well, when using data-directory on host:

The files belonging to this database system will be owned by user "postgres". This user must also own the server process. 2016-12-01T08:54:30.473228771Z The database cluster will be initialized with locale "en_US.utf8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". 2016-12-01T08:54:30.473433399Z Data page checksums are disabled. 2016-12-01T08:54:30.473468982Z fixing permissions on existing directory /var/lib/postgresql/data/pgdata ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting dynamic shared memory implementation ... posix creating configuration files ... ok LOG: could not link file "pg_xlog/xlogtemp.21" to "pg_xlog/000000010000000000000001": Operation not permitted FATAL: could not open file "pg_xlog/000000010000000000000001": No such file or directory child process exited with exit code 1 initdb: removing contents of data directory "/var/lib/postgresql/data/pgdata" running bootstrap script ...

When commenting out the Data-Directory and Socket-Director in _postgres_ in docker-compose.yml the Container is started.

Please check out the latest tag, dont use the master branch

Ok. I did. But I can't docker-compose up:

failed to allocate gateway (172.16.238.1): Address already in use

Actually, I am not that PRO. Any idea?

That means that something is already listening there.
Did u docker-compose down before starting a new instance?

You can try to:

docker-compose down
docker-compose rm
docker-compose up

Sorry. My fault.

After
`$ docker-compose.exe up -d

Creating network "devilbox_app_net" with driver "bridge"

ERROR: cannot create network
4acfc017352ee2f87e0edb8305986b8d91cae88727d7e2f77a60172f8d6bc7e1 (br-4acfc017352e): conflicts with network 48a61d13cb478ff8568dd14822db639ca12a2b58b7da48de65d4750ee5a973e0 (br-48a61d13cb47): networks have overlapping IPv4`

I had to

$ docker network rm 48a61d13cb47

Then the container started (except MySQL and Postgres). So I had to edit the docker-compose like mentioned above (changing ip address and comment out the data-container-path of postgres and socket-directory). So, same workaround like the Master-Branch.

image

I think, this Version is also not working with Windows out of the box, due to system-differences between native docker under linux-based and docker-machine on Windows-based systems.

When you check out the latest tag, there is no postgresql server included.
So basically the fix should only be to remove the mysql socket.

The different IP seems really strange to me.
Can u get a normal apache or php docker working to listen on localhost?
For example:

 docker run -i -p 8080:80  -t cytopia/nginx-stable

And then try if you can access http://127.0.0.1:8080 with your webbrowser

Yes you are right. I did not checkout the right tag. So now I did, and the problem resist.

The different IP is not strange. It's normal behavior under windows. Docker-Machine under windows uses VirtualBox to create a host docker can run on. So 127.0.0.1 will never resolve to the the docker-host created from docker-machine. On windows you have to use http://192.168.99.100 (plus port if not 80) to access any docker-container.

Thanks for the project. It looks awesome, and I really wanted to try this out, because I was developing a little php-mysql-dev-environment on docker as well (but not so cool feature - like email catch and so on).

I will make this editable via .env.

Hi @doku-san you will need to switch to the latest master branch commit now in order to make use of it.

I added LOCAL_LISTEN_ADDR=127.0.0.1: to env-example, add this to your local .env and change the IP address accordingly.

Also note the last : (colon) after the IP address which is required.
You can also leave this variable completely blank in order to have mysql, httpd and postgresql listen on all interfaces.

Let me know if this solves the first of your problems

I will close this due to inactivity. If the problem still persists after the changes I have done, just re-open

I'm under Windows 10 Home, using Docker Tool Box and using devilbox master branch. The problems reported here all still persists, except for the Local Listen Address.

Comment out the data-container-path for mysql|mariadb makes the container up.

I can change 127.0.0.1 to 192.168.99.100 in LOCAL_LISTEN_ADDR variable. Works fine.
Postgres also still have the same behaviour.

My containers are apache-2.4, php-fpm-7.0, mariadb-10.0, Postgres 9.6. My project is under user home with all permissions. Firewall is disabled.

docker version

Client:
Version: 17.03.0-ce
API version: 1.26
Go version: go1.7.5
Git commit: 60ccb22
Built: Thu Mar 2 01:11:00 2017
OS/Arch: windows/amd64

Server:
Version: 17.03.0-ce
API version: 1.26 (minimum version 1.12)
Go version: go1.7.5
Git commit: 3a232c8
Built: Tue Feb 28 07:52:04 2017
OS/Arch: linux/amd64
Experimental: false

docker-composer version

docker-compose version 1.11.2, build f963d76f
docker-py version: 2.1.0
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016

Error log:

2017-03-25 19:28:52 140418771429504 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-03-25 19:28:52 140418771429504 [Note] InnoDB: The InnoDB memory heap is disabled
2017-03-25 19:28:52 140418771429504 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-25 19:28:52 140418771429504 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-03-25 19:28:52 140418771429504 [Note] InnoDB: Compressed tables use zlib 1.2.7
2017-03-25 19:28:52 140418771429504 [Note] InnoDB: Using Linux native AIO
2017-03-25 19:28:52 140418771429504 [Note] InnoDB: Using SSE crc32 instructions
2017-03-25 19:28:52 140418771429504 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-03-25 19:28:52 140418771429504 [Note] InnoDB: Completed initialization of buffer pool
2017-03-25 19:28:52 140418771429504 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-25 19:28:52 140418771429504 [Note] InnoDB: 128 rollback segment(s) are active.
2017-03-25 19:28:52 140418771429504 [Note] InnoDB: Waiting for purge to start
2017-03-25 19:28:52 140418771429504 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.32-78.1 started; log sequence number 1600729
2017-03-25 19:28:52 140418029160192 [Note] InnoDB: Dumping buffer pool(s) not yet started
2017-03-25 19:28:52 140418771429504 [Note] Recovering after a crash using tc.log
2017-03-25 19:28:52 140418771429504 [ERROR] Can't init tc log
2017-03-25 19:28:52 140418771429504 [ERROR] Aborting

About Postgres I change nothing .

capturar

Under Windows will need to set up .devilbox\www\htdocs\vendor\phpmyadmin\.devilbox\www\htdocs\vendor\phpmyadmin as read-only file or PhpMyAdmin will fail. Just a warning to help us.

Hi everybody,

could you give it another try on the newly release devilbox version v0.9 and report back please.

This might solve it for now:

https://github.com/cytopia/devilbox/issues/70

Add

192.168.99.100 httpd

in your C:\Windows\System32\drivers\etc\hosts file

Btw, are you using Docker Toolbox or Docker for Windows

@dany-eudes @doku-san It should be fixed in the upcoming version:

Pull request is not merged yet (https://github.com/cytopia/devilbox/pull/130), however could you checkout the branch (REL-0.12) and give it a try:

  1. just to make sure everything is reset
docker-compose down
docker-compose rm -f
  1. Check out new branch
git fetch --all
git checkout REL-0.12
  1. Compare new env-example with your local .env
vimdiff .env env-example
  1. Start it up
docker-compose up -d

Hope it can fix some problems

Another thing. You could also leave LOCAL_LISTEN_ADDR= empty, so it will bind on all interfaces, which would make sure it is available to the outside of your VirtualBox.

If there are no further issues, I will mark this ticket as resolved with the upcoming release, so please double check and reply back here.

https://github.com/cytopia/devilbox/issues/248

I am already working on this problem. Please find all relevant information in the newly created issue: https://github.com/cytopia/devilbox/issues/248

To reach a broader audience I will close this ticket and link it to the new one (which will be done with multiple related issues as well).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hurrtz picture hurrtz  路  5Comments

taliptako picture taliptako  路  4Comments

lostncg picture lostncg  路  3Comments

drupalshift picture drupalshift  路  5Comments

jonatanaxe picture jonatanaxe  路  5Comments