sudo mkdir /data/mysql docker run -d --name mysql -v /data/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=3935905 -p 3306:3306 mysql:5.7.22 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
docker volume create gogs-data docker run -d --name=gogs -p 10022:22 -p 10080:3000 -v gogs-data:/data gogs/gogs # Docker搭建gogs ## 1. docker拉取鏡像並後臺運行 ```sh docker volume create gogs-data docker run -d --name=gogs -p 10022:22 -p 10080:3000 -v gogs-data:/data gogs/gogs gogs/gogs
建立了一個gogs用戶,這個就是管理員。 數據在宿主上面的/var/gogs/目錄下面,若是須要從新安裝,則清空這個目錄,而後重啓下gogs的docker鏡像便可。mysql
git clone http://192.168.1.161:10080/gogs/gogs.git touch README.md git add README.md git commit -m "first commit" git push -u origin master # 若是沒有配置ssh,則須要輸入用戶名密碼: Username for 'http://192.168.1.161:10080': gogs Password for 'http://gogs@192.168.1.161:10080': Counting objects: 3, done. Writing objects: 100% (3/3), 206 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) To http://192.168.1.8:10080/gogs/gogs.git * [new branch] master -> master Branch master set up to track remote branch master from origin.