Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

Networking issues with ubuntu provisioned image #3379

Closed
booyaa opened this issue Apr 27, 2016 · 5 comments
Closed

Networking issues with ubuntu provisioned image #3379

booyaa opened this issue Apr 27, 2016 · 5 comments

Comments

@booyaa
Copy link

booyaa commented Apr 27, 2016

Setup

docker-machine create --driver digitalocean --digitalocean-access-token $DO_PAT --digitalocean-region lon1 --digitalocean-size 1gb foo
eval "$(docker-machine env -u)"
eval "$(docker-machine env foo)"

Works fine on a virtualbox provisional

docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=password -d mariadb:5.5
docker run --name wpldn --link some-mysql:mysql -p 80:80 -d wordpress:4.5-apache
docker logs wpldn
WordPress not found in /var/www/html - copying now...
Complete! WordPress has been successfully copied to /var/www/html

Warning: mysqli::mysqli(): (HY000/2002): Connection refused in - on line 10

MySQL Connection Error: (2002) Connection refused

diagnostics

docker version
Client:
 Version:      1.11.0
 API version:  1.23
 Go version:   go1.6.1
 Git commit:   4dc5990
 Built:        Thu Apr 14 00:24:28 UTC 2016
 OS/Arch:      darwin/amd64

Server:
 Version:      1.11.1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   5604cbe
 Built:        Tue Apr 26 23:38:55 2016
 OS/Arch:      linux/amd64

docker-machine version 0.7.0, build a650a40 (machine is running OSX)

docker-machine ssh foo uname -a
Linux dddwa 4.2.0-27-generic #32-Ubuntu SMP Fri Jan 22 04:49:08 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 15.10
Release:    15.10
Codename:   wily
@booyaa booyaa changed the title Networking ubuntu provisioned image Networking issues with ubuntu provisioned image Apr 27, 2016
@nathanleclaire
Copy link
Contributor

What's logs of mysql container? Did it exit for any reason, e.g. OOM?

@booyaa
Copy link
Author

booyaa commented May 2, 2016

mysql container still running, looks like a normal log to me:

docker logs some-mysql
*snip*
160502 10:49:53 Percona XtraDB (http://www.percona.com) 5.5.48-MariaDB-37.8 started; log sequence number 0
160502 10:49:53 [Note] Plugin 'FEEDBACK' is disabled.
160502 10:49:53 [Warning] 'user' entry 'root@932994102df7' ignored in --skip-name-resolve mode.
160502 10:49:53 [Warning] 'proxies_priv' entry '@ root@932994102df7' ignored in --skip-name-resolve mode.
160502 10:49:53 [Note] Event Scheduler: Loaded 0 events
160502 10:49:53 [Note] mysqld: ready for connections.
Version: '5.5.49-MariaDB-1~wheezy'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  mariadb.org binary distribution
160502 10:49:55 [Warning] 'proxies_priv' entry '@ root@932994102df7' ignored in --skip-name-resolve mode.

@booyaa
Copy link
Author

booyaa commented May 2, 2016

Also I've now upgraded to docker for mac beta (Version 1.11.0-beta9 (build: 6388)
965e3f981d73fe82857f3c1439ba3dc1acaecab6), same problem still happening. It's as if --link isn't working, any way I can provide more diagnostics?

@nathanleclaire
Copy link
Contributor

Can you get it to work by putting them on the same docker network? --link is deprecated / legacy. If there's a regression, best to just switch over to the new model.

docker network create wordpress

docker run \
    --net wordpress \
    --net-alias mysql \
    --name some-mysql \
    -e MYSQL_ROOT_PASSWORD=password \
    -d mariadb:5.5

docker run \
    --net wordpress \
    --name wpldn \
    -p 80:80 \
    -d wordpress:4.5-apache

IIRC

@booyaa
Copy link
Author

booyaa commented May 4, 2016

Unfortunately it doesn't work, one of the benefits of --link was to share the ENV variables with the linking container.

The WordPress container (specifically the entrypoint.sh script) is expecting to find, these environment variables

MYSQL_ENV_MYSQL_ROOT_PASSWORD=xxx
MYSQL_PORT_3306_TCP=tcp://172.17.0.2:3306

I think I've found a workaround by using --env-file and storing those variables in a file (replacing the ip address with the network alias mysql). It's a shame it was nice to have these secrets being passed around automatically. I'll do some proper testing to make sure it works.

I'll reference this issue raised in the WordPress official image, whilst not using networks does deprecate the use of --link docker-library/wordpress#134

@booyaa booyaa closed this as completed May 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants