Docker compose up issue for running jenkins container

Hello Team,

I was creating jenkins container via creating dockerfile
config mention in screenshot.
But after running docker-compose up
It shows permission denied error.
Please help me in this case.

I am trying to understand since 3 days.
But didn’t get any help.

Hi @pandit.gaur43,

Based on your screenshot, your docker-compose file its own by Root and sudo on the command to run or change the ownership of the file :

sudo docker-compose up -d

Regard

Hello thank you for your reply.
Do you want me to do any change in docker-compose.yml file?
Anything need to be change here. If yes would you please tell me what to change here.
version ‘3’
services:
jenkins:
container_name: jenkins
images: jenkins/jenkins
port:
- 80808:8080
volume:
- "pwd/jenkins-volume:/var/jenkins_home/
network:
- net:
network:
net:
Becasue I am not in root folder so that is why running docker-compose.yml file in sudo.

I run same command as you mention and got error


and why getting this volume mapping in docker-compose.yml file.

Hi @pandit.gaur43,
Have you watched the Docker beginner course? Especially docker-compose lecture. Because you need to remove the double quotes from the pwd. Also, the path seems wrong.

Please refer this official docs -

Regards,

Not understanding why getting this error again and again.
Even though everything seems fine.


I am struggling from this concern since 2-3 days.

See here I did create volume and mount that path under newcreate “jenkins-volume” folder in docker-compose.yml file.
Now while running sudo docker compose up -d
still getting that error please help and suggest if I am doing something.

Hi @pandit.gaur43 ,

You are missing the colon in the version field.

version: "3" 

Now after running docker-compose up -d getting new error


Please help me in this issue.

It’s an image, not images.

Please read more about the pre-defined name from the below official docs.

Like image, container_name, entrypoint, and env_file etc…

Regards,

Thank you very much Mr. tej.
You did provide me great help.
My jenkins interface has been created .
My next concern is I did create my-vol folder and map this folder to jenkins-volume under docker compose file.
Now according to process all jenkins container data should be in jenkins-volume since it mapped to my-vol.
When I was seeing volume data in either in jenkins-volume or in my-vol by doing
ls docker-volume or ls /var/lib/docker/volumes/my-vol/_data
no volume data is showing.
Please help in this
So that after running container on server and after removing or erasing by docker compose down.
Once running that container on server by docker compose up -d. It should come w


ith all same config that stored in volume.

I have created one dockerfile.
And while running via sudo docker compose up
getting this error .
Please guide me what is the issue.