This following will show how to upgrade gitlab container to newer version along with issue you might meet and how we deal with it.
First, you need to ensure that your gitlab container is using docker volumes to store the git repository, configuration and so on. You can use either use docker inspect to check the detail configuration or just use ls to ensure it if you know where is it.
docker inspect gitlab | awk ‘{ print $1 }’ | grep ^\”/srv/gitlab/
ls -al /srv/gitlab
Now, you can continue without any hesitation. In this step, you will need to stop your gitlab container, remove it, pull the latest gitlab docker container, and re-run the gitlab container. You can also modify the configuration to meet your needs.
docker stop gitlab
docker rm gitlab
docker pull gitlab/gitlab-ce:latest
sudo docker run –detach \
–hostname your.hostname \
–env GITLAB_OMNIBUS_CONFIG=”external_url ‘https://your.hostname/‘; gitlab_rails[‘lfs_enabled’] = true; gitlab_rails[‘gitlab_shell_ssh_port’] = 22222;” \
–publish 443:443 –publish 80:80 –publish 22:22 \
–name gitlab \
–restart always \
–volume /srv/gitlab/config:/etc/gitlab \
–volume /srv/gitlab/logs:/var/log/gitlab \
–volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
Your gitlab should be available within a few minutes. If not, you can use the following command to diagnose potential problems.
docker logs gitlab
docker exec -i -t gitlab /bin/bash
This following shows the issue I meet when using gitlab container and how I deal with it.
fatal: protocol error: bad line length character:
The
The message above is truncated. Therefore, we need to use ssh to figure out the complete message.
PTY allocation request failed on channel 0
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
This issue is actually a common issue of the old version docker (like docker-io in CentOS 6). We can issue the following command inside gitlab container to deal with it.
docker exec -i -t gitlab /bin/bash
sed -i ‘s@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g’ /etc/pam.d/sshd
The tutorial today end here. Please feel free to comment or contact me if you need further help.
4 replies on “Upgrade GitLab docker container to newer version”
大神啊,这英语水平高,俺只能看懂一半
very good
看不懂,╮(╯▽╰)╭,看得懂文言文,看不懂英文
太高大上了