2019-02-16
Most of the steps were the same for me as the others has written. However, I was not able to add jenkins to the group docker using usermod with the mentioned solutions.
I tried the following command from the docker host, and from the running docker container:
sudo usermod -a -G docker jenkins
(I entered to the running docker container with the following command from the docker host:
docker exec -t -i my_container_id_or_name /bin/bash
)
Received from docker host:
usermod: user 'jenkins' does not exist
Received from docker container:
We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:
#1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility.
[sudo] password for jenkins:
I didnt know the password.
Without the sudo
part of the command, in the docker container I received:
usermod: Permission denied. usermod: cannot lock /etc/passwd; try again later.
Solution: I entered to the running docker container from the docker host with the following command:
docker exec -t -i -u root my_container_id_or_name /bin/bash
Now, I entered as root, and issued the following command:
usermod -a -G docker jenkins
Then, from the docker host, I restarted my running docker container with the following command:
docker restart my_container_id_or_name
After that, I started the jenkins job and it finished with success.
I only used the root user to issue the usermod
command for the user jenkins
.