issue

# ./docker-compose up -d
Creating network "gogs_default" with the default driver
Creating gogs_mysql_1 ... done
Creating gogs_gogs_1  ... error

ERROR: for gogs_gogs_1  Cannot create container for service gogs: invalid port specification: "133342"

ERROR: for gogs  Cannot create container for service gogs: invalid port specification: "133342"
ERROR: Encountered errors while bringing up the project.
services:
  gogs:
    ports:
      - 2222:22

YAML supports so-called “base-60 floating-point numbers,” which is useful for time calculations.

Therefore, 2222:22 is interpreted as 2222 * 60 + 22, which is 133342.

If the port contains numbers greater than 60, such as 3306:3306 or 8080:80, there is no problem, so this issue doesn’t always occur, making it somewhat obscure.

solve

services:
  gogs:
    ports:
      - "2222:22"