If not the
rootuser, addsudobefore the command
1. Create a directory to store the index
mkdir -p /data/opengrok/data

2. Pull the latest image of opengrok
docker pull scue/docker-opengrok:latest

3. Start the opengrok container
docker run -itd --restart=always -v {project directory path}:/src -v /data/opengrok/data:/data -p 8090:8080 --name opengrok scue/docker-opengrok
{Project directory path}: fill in the project code directory on your service/data/opengrok/data: just created the directory to store the index-p 8090:8080: open 8090 on the left to the port you want to be accessible to the outside world, for example:http://{server ip}:8090/source

Browser access: http://{server ip}:8090/source
4. Reindex after code update
into the container
docker exec -it opengrok bash

reindex
/opengrok-0.12.1.5/bin/OpenGrok index /src

exit the container
exit

5. Stop the container
docker stop opengrok
6. Delete the container
docker rm -f opengrok

Post comment 取消回复