{"action":"created","issue":{"url":"https://api.github.com/repos/gogits/gogs/issues/2015","labels_url":"https://api.github.com/repos/gogits/gogs/issues/2015/labels{/name}","comments_url":"https://api.github.com/repos/gogits/gogs/issues/2015/comments","events_url":"https://api.github.com/repos/gogits/gogs/issues/2015/events","html_url":"https://github.com/gogits/gogs/issues/2015","id":118256341,"number":2015,"title":"gogs in Docker container uses Host IP trying to access linked DB container","user":{"login":"nem75","id":1327785,"avatar_url":"https://avatars.githubusercontent.com/u/1327785?v=3","gravatar_id":"","url":"https://api.github.com/users/nem75","html_url":"https://github.com/nem75","followers_url":"https://api.github.com/users/nem75/followers","following_url":"https://api.github.com/users/nem75/following{/other_user}","gists_url":"https://api.github.com/users/nem75/gists{/gist_id}","starred_url":"https://api.github.com/users/nem75/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nem75/subscriptions","organizations_url":"https://api.github.com/users/nem75/orgs","repos_url":"https://api.github.com/users/nem75/repos","events_url":"https://api.github.com/users/nem75/events{/privacy}","received_events_url":"https://api.github.com/users/nem75/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-22T10:57:02Z","updated_at":"2015-11-22T18:34:06Z","closed_at":null,"body":"Hi, I'm trying to run gogs with this `docker-compose.yml`, linking it with a MariaDB container:\r\n\r\n    gogs:\r\n      image: gogs/gogs\r\n      ports:\r\n        - \"10022:22\"\r\n        - \"8080:3000\"\r\n      links:\r\n        - db\r\n\r\n    db:\r\n      image: mariadb\r\n      environment:\r\n        - MYSQL_ROOT_PASSWORD=rootpass\r\n        - MYSQL_DATABASE=gogs\r\n        - MYSQL_USER=gogs\r\n        - MYSQL_PASSWORD=gogs\r\n\r\nOn `localhost:8080` I configure gogs to use these database settings, but always get the error message shown:\r\n\r\n![screenshot from 2015-11-22 11-47-02](https://cloud.githubusercontent.com/assets/1327785/11323273/e60bd908-910e-11e5-8b9e-2d4ed87716f8.png)\r\n\r\n`77.37.17.149` is the IP of my router, which means that inside the gogs container a hostname is used for the DB which cannot be resolved (which then, via a catch-all, is resolved to the router). This is supported by the fact that the linked `db` container resolves (correctly) to a `172.*` address from inside the gogs container:\r\n\r\n    $ docker exec -ti gogs_gogs_1 bash\r\n    bash-4.3# ping db\r\n    PING db (172.17.0.2): 56 data bytes\r\n    64 bytes from 172.17.0.2: seq=0 ttl=64 time=0.404 ms\r\n    64 bytes from 172.17.0.2: seq=1 ttl=64 time=0.185 ms\r\n    ^C\r\n\r\nAlso, MariaDB is clearly reachable from within the gogs container:\r\n\r\n    bash-4.3# telnet db 3306\r\n    5.5.5-10.0.21-MariaDB-1~jessie1`(....)\r\n\r\nSo what hostname does the gogs container use trying to connect to the database? It's not `db`, or else it would work. Any ideas?"},"comment":{"url":"https://api.github.com/repos/gogits/gogs/issues/comments/158787530","html_url":"https://github.com/gogits/gogs/issues/2015#issuecomment-158787530","issue_url":"https://api.github.com/repos/gogits/gogs/issues/2015","id":158787530,"user":{"login":"Unknwon","id":2946214,"avatar_url":"https://avatars.githubusercontent.com/u/2946214?v=3","gravatar_id":"","url":"https://api.github.com/users/Unknwon","html_url":"https://github.com/Unknwon","followers_url":"https://api.github.com/users/Unknwon/followers","following_url":"https://api.github.com/users/Unknwon/following{/other_user}","gists_url":"https://api.github.com/users/Unknwon/gists{/gist_id}","starred_url":"https://api.github.com/users/Unknwon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unknwon/subscriptions","organizations_url":"https://api.github.com/users/Unknwon/orgs","repos_url":"https://api.github.com/users/Unknwon/repos","events_url":"https://api.github.com/users/Unknwon/events{/privacy}","received_events_url":"https://api.github.com/users/Unknwon/received_events","type":"User","site_admin":false},"created_at":"2015-11-22T18:34:06Z","updated_at":"2015-11-22T18:34:06Z","body":"cc @0rax "}}