I am trying to encapsulate Gogs with MySQL with docker-compose.
I have the following problem:
-When I run the containers separately (with $docker run) I can install the database correctly.
-Otherwise, when I mix the two containers in a docker-compose.yml, it notice the following error in the first-time install:
Database setting is not correct: dial tcp 127.0.0.1:3306: getsockopt: connection refused
I am running the 1.18 version of docker compose in a Ubuntu 16.04 VM. The Gogs version is the :latest
version: '3.4' services: mysql: image: mysql ports: - 3306:3306 volumes: - ~/workspace/db:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=rootpass - MYSQL_DATABASE=gogs - MYSQL_USER=user - MYSQL_PASSWORD=pass gogs: image: gogs/gogs ports: - 10080:3000 - "10022:22" links: - mysql volumes: - ~/workspace/gogs:/data
Note: I use “10022:22” to avoid that error:
ERROR: for documents_gogs_1 Cannot create container for service gogs: invalid port specification: "601342"