cptactionhank / docker-atlassian-jira-software

Atlassian JIRA Software wrapped in a Docker image
https://cptactionhank.github.io/docker-atlassian-jira-software
MIT License
270 stars 168 forks source link

Get Root privileges #10

Closed royhenengel closed 7 years ago

royhenengel commented 7 years ago

Hi there, I have a small question if I may. Is there any way to get Root privileges/permissions? Thank you.

cptactionhank commented 7 years ago

is ‘docker exec -ti -u 0:0 container_id‘ what you are thinking of?

royhenengel commented 7 years ago

Hi, first of all, thank you so much for your reply. To tell you the truth I'm not sure exactly what's the meaning of the command you asked about. All I can say is that on my platform (Synology-DSM), the only way I can manage the container is via a -bash, and when trying to run Docker, the Docker commands are not found. As for permission, my goal is to manage the Jira server instance as root. For example, write files into the JIRA_INSTALL directory. I tried changing permissions for the directory, but the action is not permitted for daemon:daemon. I'm sorry that I can't be more accurate about everything. My knowledge of Servers is quite limited, and I'm learning all of this on the go. Also, there is almost zero documentation of using Docker on my platform, so it's a bit difficult to find the required action. Your patience is much appreciated.

cptactionhank commented 7 years ago

Please elaborate on how you create and run the container, so I might better be able to infer what help you are seeking.

royhenengel commented 7 years ago

No problem. I'll be sending you as soon as possible a short video screen capture so you could exactly everything.

cptactionhank commented 7 years ago

Also please provide the output of the command docker version and docker info

royhenengel commented 7 years ago

of course!

royhenengel commented 7 years ago

Hi as promised here is a short video screen capture of the whole setup of the container, and at the end the command I'm trying to execute the respective output. I tried to keep it as short as possible to not waste your time. If you require/would like more info about anything else, just say so.

https://1drv.ms/v/s!AkkKHWeBCU1WhOlwU8r4wv7E8oCpqw

*Although I used a capital D for the command docker --version, the output is the same

royhenengel commented 7 years ago

HI, Did you get the video? Was everything clear? Do you need more info?

cptactionhank commented 7 years ago

You permissions problems is caused by limitations of the interface you are using and are accessing the bash terminal as the same user defined in the Dockerfile and the user that JIRA is executing as.

You can use the command docker cp /folder/* container_id:/opt/atlassian/jira/atlassian-jira/images/ from a terminal on the server (NOT from a console inside a container).

Another thing you could to is to start a terminal in your existing container with sudo permissions instead, this is done by the command docker exec -ti -u root:root container_id from a terminal on the server (NOT from a console inside a container).

Overriding the environment variables has no effect and something you should avoid at least when it comes to JIRA_HOME and JIRA_INSTALL.

royhenengel commented 7 years ago

Would you be so kind and just point me in the right direction (URL tutorial or explanation) because of my limited knowledge in servers:

  1. What do you mean by : "...from a terminal on the server (NOT from a console inside a container)." The only way I saw I can access a terminal to server is from the -bash command (as shown in the video screen capture)." Are there other ways I can control the container from a terminal?
  2. The command "docker..." Isn't recognized in the terminal as I opened it (-bash in my container terminal). Will it be recognized from a terminal on a server?

Again thank you for your time and help.

cptactionhank commented 7 years ago
  1. I see in the video (2:34) you are executing Docker --version in a bash terminal inside a Docker container. You should use the servers terminal (the outer terminal) where docker should be available to control and administer containers on the server. Also not the the terminal is case-sensitive so you must type docker and not Docker.
  2. I don't know if the docker command will be available in the terminal, it depends on the server and I do not have experience with Synology. But I believe there's a strong likelyhood that is, it's more of a Synology support thing. Perhaps have a look here https://forum.synology.com/enu/viewtopic.php?t=83686.
royhenengel commented 7 years ago

OK, I think I got it. I'll try continuing to work on it. If I have other questions, Is it OK to contact you?

Again, thank you

cptactionhank commented 7 years ago

Sure, but please be aware I do not own and netiher have any experience with Sonology server

royhenengel commented 7 years ago

Of-course. OK, so what I did is connected to my server via SSH. Finally the "docker..." command is recognised. My docker version is: Client: Version: 1.11.2 API version: 1.23 Go version: go1.4.2 Git commit: eabacaa-synology Built: Sat Jun 18 19:01:00 2016 OS/Arch: linux/amd64

At the end of this output, and when running "docker ps" to see the running containers and their ID I get: "Cannot connect to the Docker daemon. Is the docker daemon running on this host?" even that the container is running. Any advice?

Best regards

cptactionhank commented 7 years ago

Perhaps your servers configuration only exposes the docket host through http and not the default UNIX socket at /var/run/docker.sock

royhenengel commented 7 years ago

What does that mean? The image attached is the output of verifying if docker daemon is running, and the output of trying to get logs 2016-07-29_15-07-14 Is this relevant?

cptactionhank commented 7 years ago

Have a look at https://forum.synology.com/enu/viewtopic.php?t=113972#p418061

Kind regards,

Martin Jensen

On 29. jul. 2016, at 13.47, henengel notifications@github.com wrote:

What does that mean?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

royhenengel commented 7 years ago

Thanks for the link. When running as root and not admin it works. Thanks 👍

royhenengel commented 7 years ago

This is the output when I run the one of the commands you told me to: docker exec -ti -u root:root container_id 2016-07-29_15-28-14 Continueing to work on the other command...

cptactionhank commented 7 years ago

Sorry, you should append "bash" at the end

Kind regards,

Martin Jensen

On 29. jul. 2016, at 14.30, henengel notifications@github.com wrote:

This is the output when I run the one of the commands you told me to: docker exec -ti -u root:root container_id

Continueing to work on the other command...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

royhenengel commented 7 years ago

Awsome!!!! Thank you so much...

2016-07-29_16-42-23

By the way, when creating the container, should there be a problem installing the image if I change the container name? If I'm not mistaken, I think I had one when doing so, but I didn't get to troubleshooting it...

cptactionhank commented 7 years ago

The container name is just for simplicity administering it, it should not be a problem

Kind regards,

Martin Jensen

On 29. jul. 2016, at 15.47, henengel notifications@github.com wrote:

Awsome!!!! Thank you so much...

By the way, when creating the container, should there be a problem installing the image if I change the container name? If I'm not mistaken, I think I had one when doing so, but I didn't get to troubleshooting it...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

royhenengel commented 7 years ago

Thanx!!!

cptactionhank commented 7 years ago

Closed due to platforms problems controlling Docker.