docker run -d \
-p 5000:5000 -p 80:8081 -p 22:22 \
--name gitlab \
--restart always \
-v $GITLAB_HOME /config:/etc/gitlab \
-v $GITLAB_HOME /logs:/var/log/gitlab \
-v $GITLAB_HOME /data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
docker exec -t -i gitlab vim /etc/gitlab/gitlab.rb
编辑 /usr/lib/systemd/system/gitlab.service
[Unit ]
Description=Gitlab Service
After=docker.service
Requires=docker.service
[Service ]
Environment="PORT=-p 80:80 -p 8443:443 -p 2222:22"
Environment="VOLUME=-v /gitlab/config:/etc/gitlab -v /gitlab/logs:/var/log/gitlab -v /gitlab/data:/var/opt/gitlab"
Environment="ENV="
Environment="ARGS="
Environment="IMAGE=gitlab/gitlab-ce"
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStart=/usr/bin/docker run --name %n $PORT $VOLUME $ENV $IMAGE $ARGS
TimeoutStartSec=0
Restart=always
[Install ]
WantedBy=multi-user.target
# 启动一个runner
docker run --restart=always -d --name gitlab-runner -v /gitlab/runner:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
# 注册,按照要求填写
docker exec -it gitlab-runner gitlab-ci-multi-runner register --locked=false
# 签出代码为git库
git svn clone http://192.168.8.63/svn/dc -s --authors-file=users.txt
cd dc
# 再次更新到最新代码
git svn fetch
# 添加git远程地址
git remote add origin https://gitlab.ewinlu.com/unitrans/data-center.git
# 同步本地库到远程
git push --set-upstream origin master
#! /bin/bash
EXCLUDE_FROM_GC=(' registry.uutaka.com/docker/ci-tools:latest' ' registry.uutaka.com/docker/docker-maven/maven:3.5-jdk-8' )
# Remove all the dangling images
docker rmi $( docker images -qf " dangling=true" )
# Get all the images currently in use
USED_IMAGES=($( \
docker ps -a --format ' {{.Image}}' | \
sort -u | \
uniq | \
awk -F ' :' ' $2{print $1":"$2}!$2{print $1":latest"}' \
) )
# Get all the images currently available
ALL_IMAGES=($( \
docker images --format ' {{.Repository}}:{{.Tag}}' | \
sort -u \
) )
# Remove the unused images
for i in " ${ALL_IMAGES[@]} " ; do
UNUSED=true
for j in " ${USED_IMAGES[@]} " ; do
if [[ " $i " == " $j " ]]; then
UNUSED=false
fi
done
for k in " ${EXCLUDE_FROM_GC[@]} " ; do
if [[ " $i " == " $k " ]]; then
UNUSED=false
fi
done
if [[ " $UNUSED " == true ]]; then
docker rmi " $i "
fi
done