Skip to content

Instantly share code, notes, and snippets.

@padeoe
Last active January 11, 2019 02:10
Show Gist options
  • Save padeoe/a0d8d55b3ceddf58610a9f13dd895c3f to your computer and use it in GitHub Desktop.
Save padeoe/a0d8d55b3ceddf58610a9f13dd895c3f to your computer and use it in GitHub Desktop.
gitlab docker check update script
# pull the latest image
check_update=`docker pull gitlab/gitlab-ce:latest`
# Check if newer image pulled
if [[ $check_update == *"Image is up to date for gitlab/gitlab-ce:latest"* ]]
then
echo 'Gitlab is already up to date!'
else
echo 'Start to update Gitlab...'
# stop existing gitlab container
docker stop GITLAB_CONTAINER_NAME
# rename old container
docker rename GITLAB_CONTAINER_NAME gitlab_old
# disable boot start
docker update --restart=no gitlab_old
# start gitlab container with latest image
docker run --detach \
--hostname YOUR_GITLAB_DOMAIN \
--publish 443:443 --publish 80:80 --publish 22:22 \
--name GITLAB_CONTAINER_NAME \
--restart always \
--volume /path/to/your/gitlab/config:/etc/gitlab \
--volume /path/to/your/gitlab/logs:/var/log/gitlab \
--volume /path/to/your/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
# docker rm gitlab_old #remove old container
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment