Docker container: Gitea

Docker container on DockerHub
https://hub.docker.com/r/gitea/gitea

Docker installation
https://docs.gitea.io/en-us/install-with-docker/

apt -y install docker-compose
 
# Add second ip to hypervisor
ip a add 192.168.1.3 dev eth0:1
 
# Bound SSHD on hypervisor to specific IP
sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 10.0.1.3/' /etc/ssh/sshd_config
service ssh restart
 
# OPTIONAL: create ZFS pool
zfs create -o mountpoint=/media/docker tank/docker
 
# create required directories
mkdir -p /media/docker/gitea/mysql /media/docker/gitea/data
 
cat <<EOF> /media/docker/gitea/docker-compose.yml
version: "2"
 
networks:
  gitea:
    external: false
 
services:
  web:
    image: gitea/gitea:latest
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - DB_TYPE=mysql
      - DB_HOST=db:3306
      - DB_NAME=gitea
      - DB_USER=gitea
      - DB_PASSWD=gitea
    restart: always
    networks:
      - gitea
    volumes:
      - /media/docker/gitea/data:/data
    ports:
       - 192.168.1.3:80:3000
       - 192.168.1.3:22:22
    depends_on:
      - db
 
  db:
    image: mariadb:latest
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=gitea
      - MYSQL_USER=gitea
      - MYSQL_PASSWORD=gitea
      - MYSQL_DATABASE=gitea
    networks:
      - gitea
    volumes:
      - /media/docker/gitea/mysql:/var/lib/mysql
EOF
 
# deploy container
cd /media/docker/gitea
docker-compose up -d

Post-install
http://GITEA_IP/install

Debug

# debug ports on hypervisor
netstat -tulpen | grep 22
 
# docker-compose ps
   Name                  Command               State                        Ports                      
-------------------------------------------------------------------------------------------------------
gitea_db_1    docker-entrypoint.sh mysqld      Up      3306/tcp                                        
gitea_web_1   /usr/bin/entrypoint /bin/s ...   Up      192.168.1.3:22->22/tcp, 192.168.1.3:80->3000/tcp

Change password

docker exec -it -u git gitea_web_1 bash
gitea admin change-password --username "foo@example.com" --password "pass1234"

Links
http://www.panticz.de/gitea