Running Git Server using Gogs on Docker

Create network

docker network create gogs

Create MySQL

docker run -d --net gogs  \
-e MYSQL_ROOT_PASSWORD=secret \
-e MYSQL_DATABASE=gogs \
-e MYSQL_USER=gogs \
-e MYSQL_PASSWORD=secret \
 --name="gogs_db" \
 -v gogs_mysql:/var/lib/mysql \
 mysql:5.7

Create Gogs

docker run -d --net gogs \
--name=gogs \
-p 10022:22 \
-p 10080:3000 \
-v gogs_data:/data \
gogs/gogs

Remote shell into MySQL container.

docker exec -it gogs_db bash

Execute these commands in MySQL container.

SET GLOBAL innodb_file_per_table = ON,
           innodb_file_format = Barracuda,
           innodb_large_prefix = ON;
DROP DATABASE IF EXISTS gogs;
CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

Go to http://localhost:10080/install and configure Gogs.

Sign up the first account (assumed Admin) and it is ready to use.

Enjoy!

Note: To use SSH, use this URL format instead: ssh://git@hostname:10022/username/myrepo.git

References

Revision #2
Created Sun, May 12, 2019 10:57 AM by Par
Updated Sun, May 12, 2019 11:50 AM by Par