Skip to content

Instantly share code, notes, and snippets.

@edm00se
Created November 11, 2016 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edm00se/764c067ec485f5cf1d1518f71dd2d029 to your computer and use it in GitHub Desktop.
Save edm00se/764c067ec485f5cf1d1518f71dd2d029 to your computer and use it in GitHub Desktop.
docker run --detach \
--hostname gitlab.MY_COMPANY_NAME.com \
--publish 8443:443 --publish 8080: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 \
--volume /srv/gitlab/ssl:/etc/gitlab/ssl \
gitlab/gitlab-ce:latest
#!/bin/bash
CONTAINER_NAME='gitlab'
DOCKER_SOURCE='gitlab/gitlab-ce'
VERSION='latest'
HOST_NAME='gitlab.MY_COMPANY_NAME.com'
# Pull latest GitLab-CE image from Docker Hub
docker pull $DOCKER_SOURCE:$VERSION
# Assumes 'gitlab' image is running, need to
# 1. stop
docker stop $CONTAINER_NAME
# 2. remove
docker rm $CONTAINER_NAME
# 3. create new image from command, needs to be the same to persist correctly
docker run --detach \
--hostname $HOST_NAME \
--publish 8443:443 --publish 8080:80 --publish 22:22 \
--name gitlab \
--restart always \
--volume /srv/$CONTAINER_NAME/config:/etc/gitlab \
--volume /srv/$CONTAINER_NAME/logs:/var/log/gitlab \
--volume /srv/$CONTAINER_NAME/data:/var/opt/gitlab \
--volume /srv/$CONTAINER_NAME/ssl:/etc/gitlab/ssl \
$DOCKER_SOURCE:$VERSION
# done! GitLab will do its initial setup and be running with a couple minutes
echo 'Assuming no errors, your newly updated container is now starting up.'
echo "Recommended: run 'docker stats' to observe the CPU consumption. After it settles back down to ~1%, you should be good to go"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment