Title: Add external plugin to sonarqube
Tags: docker;sonarqube
Question: 

I'm running sonarqube in a docker container using this compose docker file:
docker-compose 

I want to add an external plugin (jar file). I couldn't manage to do so. Any ideas?

Comment: Since i'm very new to docker, still do not know how to do that.

Comment: The path is: SONARQUBE_HOME/extensions/plugins/

Comment: You can follow the structure of your referenced docker-compose file and bind it to your container through a volume.

Comment: Okay. So you want to add a jar to your service "sonarqube", yes? Where do you want to store it inside of this service (i.e. what should be the path to your jar in the container)?

Here is the accepted answer: Just copy your jars to your local folder "sonarqube_extensions/plugins" which should exist next to your docker-compose.yml file and they will be linked into your container according to your referenced docker-compose.yml file.

Old answer

You can modify your existing docker-compose.yml file. Assuming your jar files are located in a folder named "external_jars" next to the compose file and you want these jars to be available inside the container under, for example, ```/opt/sonarqube/external_jars``` (I am not familiar with sonarQube and I do not know how the correct structure should look like). Then you can add one line to this excerpt of your compose file:

```sonarqube:
    image: sonarqube
    ports:
      - "9000:9000"
    networks:
      - sonarnet
    environment:
      - SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar
    volumes:
      - external_jars:/opt/sonarqube/external_jars  # <-- Added this line
      - sonarqube_conf:/opt/sonarqube/conf
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_extensions:/opt/sonarqube/extensions
      - sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins
```

Or you just add the jars locally into the folder "sonarqube_extensions" if this is the correct folder. I do not know what you want to achieve, therefore I can only guess what you are trying.

"Volumes" are linked folders between your local machine (which is running the docker engine) and the container. The syntax "sonarqube_extensions:/opt/sonarqube/extensions" means: map the contents of "sonarqube_extensions" of the local machine to the container and make it accessible at the path "/opt/sonarqube/extensions".

Comment for this answer: Thanks @n2o. That worked. A precision though: the local folder "sonarqube_extensions" is created in /var/lib/docker


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 4, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2017:00:01/03/17', 'FavoriteCount': 1.0, 'PostTypeId': 1, 'Tags': '<docker><sonarqube>', 'Title': 'Add external plugin to sonarqube', 'ViewCount': 1758, 'id': 41440090, 'user_AboutMe': '', 'user_AccountId': 1791130.0, 'user_DisplayName': 'ridi', 'user_Reputation': 61.0, 'user_Views': 14.0, 'user_id': 1631509.0}}