启动Docker服务
service docker start
Docker拉取gogs镜像
docker pull gogs/gogs
创建Gogs文件夹
mkdir -p /home/gogs
Docker创建gogs服务
docker run --name=gogs -p 10022:22 -p 8081:3000 -v /home/gogs:/data gogs/gogs
[root@iZuf6boi8ejfovwda7q1ynZ ~]# docker run --name=gogs -p 10022:22 -p 8081:3000 -v /home/gogs:/data gogs/gogs usermod: no changes Dec 26 15:34:55 syslogd started: BusyBox v1.25.1 2017/12/26 15:34:55 [ WARN] Custom config '/data/gogs/conf/app.ini' not found, ignore this if you're running first time 2017/12/26 15:34:55 [TRACE] Custom path: /data/gogs 2017/12/26 15:34:55 [TRACE] Log path: /app/gogs/log 2017/12/26 15:34:55 [TRACE] Build Time: 2017-11-22 08:19:49 UTC 2017/12/26 15:34:55 [TRACE] Build Git Hash: 2017/12/26 15:34:55 [TRACE] Log Mode: Console (Trace) 2017/12/26 15:34:55 [ INFO] Gogs 0.11.34.1122 2017/12/26 15:34:55 [ INFO] Cache Service Enabled 2017/12/26 15:34:55 [ INFO] Session Service Enabled 2017/12/26 15:34:55 [ INFO] SQLite3 Supported 2017/12/26 15:34:55 [ INFO] Run Mode: Development Dec 26 15:34:55 sshd[32]: Server listening on :: port 22. Dec 26 15:34:55 sshd[32]: Server listening on 0.0.0.0 port 22. 2017/12/26 15:34:55 [ INFO] Listen: http://0.0.0.0:3000
访问http://git.xxyx.club:8081
gogs后台运行
[root@iZuf6boi8ejfovwda7q1ynZ ~]# docker run --name=gogs -d -p 10022:22 -p 8081:3000 -v /home/gogs:/data gogs/gogs /usr/bin/docker-current: Error response from daemon: Conflict. The name "/gogs" is already in use by container 79e1774e47202b2e167ff63361dfb461de9abd7ac7568408579ee3f8f34d812d. You have to remove (or rename) that container to be able to reuse that name.. See '/usr/bin/docker-current run --help'. [root@iZuf6boi8ejfovwda7q1ynZ ~]# docker run --name=gogs2 -d -p 10022:22 -p 8081:3000 -v /home/gogs:/data gogs/gogs 0c22d8ffbc5155302bbcb056791c0611fbc2e4bd847ccb378bf0a0982ad78966