Dockerを使用したGitlabサービスの導入と基礎操作の説明

6734 ワード

Docker導入Gitlabおよび一般的な基礎操作
docker-install-gitlab.shスクリプトの編集
#!/bin/bash

set -e

#pull gitlab image
docker pull gitlab-ce
# or offline
# docker load < `pwd`/gitlab.tar.gz

#create datadir 
mkdir -p data/gitlab
GITLAB_HOME=`pwd`/data/gitlab

#run gitlab container
docker run -d \
    --hostname gitlab \
    --publish 8443:443 --publish 8089:80 --publish 2222:22 \
    --name gitlab \
    --restart always \
    --volume $GITLAB_HOME/config:/etc/gitlab \
    --volume $GITLAB_HOME/logs:/var/log/gitlab \
    --volume $GITLAB_HOME/data:/var/opt/gitlab \
    gitlab/gitlab-ce

docker-install-gitlab.shスクリプトを実行すれば、gitlabの起動が遅く(5分)、localhost:8089にアクセスし、最初のログインにはrootパスワードを設定する必要があります.
gitクライアント操作コマンド:
Git global setup
git config --global user.name "Administrator"
git config --global user.email "[email protected]"

Create a new repository

git clone http://gitlabIP:Port/root/Andriy.git
cd Andriy
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

Delete a repository

git clone http://gitlabIP:Port/root/Andriy.git
git rm -rf README.md
git commit -m "delete README"
git push -u origin master

Existing folder

cd existing_folder
git init
git remote add origin http://gitlabIP:Port/root/Andriy.git
git add .
git commit -m "Initial commit"
git push -u origin master

Existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin http://gitlabIP:Port/root/Andriy.git
git push -u origin --all
git push -u origin --tags