vivekvroy
vivekvroy

Reputation: 27

Gerrit Setup using Docker image

I have installed gerrit using docker images. I can run this gerrit setup with the below command:

docker run -ti -p 8080:8080 -p 29418:29418 gerritcodereview/gerrit

It keeps running. I can access it with localhost:8080

Say, I create 3 users user1, user2, user3.

If by chance the running docker process is killed or exited and I run that command again, the setup comes up newly. All the old data or users are lost.

Even if the system goes down or rebooted, data shouldn't be lost or the users can't be deleted.

Upvotes: 2

Views: 3249

Answers (1)

LinPy
LinPy

Reputation: 18578

you need to start the container with volume mount:

   -v /path/localhost/:/var/gerrit/git
   -v /path2/localhost/:/var/gerrit/db
   -v /path3/localhost/:/var/gerrit/index
   -v /path4/localhost/:/var/gerrit/cache

you can see in the docs following example:

version: '3'

services:
  gerrit:
    image: gerritcodereview/gerrit
    volumes:
       - git-volume:/var/gerrit/git
       - db-volume:/var/gerrit/db
       - index-volume:/var/gerrit/index
       - cache-volume:/var/gerrit/cache
    ports:
       - "29418:29418"
       - "8080:8080"

volumes:
  git-volume:
  db-volume:
  index-volume:
  cache-volume:

it is up to you to use named or mount volumes

Upvotes: 2

Related Questions