Jenkins ansible-playbook with tag docker_login error












0















I try to create docker image and put it into docker registry.



I have docker on server and running Jenkins image. (So Jenkins is a docker container)



Inside Jenkins I have job that should build image out of my code and put it in docker registry.



so




build_docker.yml




---
- hosts: localhost
vars:
git_branch: "{{ GIT_BRANCH|default('development') }}"
tasks:
- name: Log into Docker registry
docker_login:
registry_url: https://registry.docker....
username: user
password: ....


I get an error



TASK [Log into Docker registry] 
************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Error connecting: Error while fetching server API version: ('Connection aborted.', error(2, 'No such file or directory'))"}


I try to found what is wrong but I can found anything but:



answer



So my question is, it this error due to a missing docker inside docker container (Jenkins)? Or could be some other reason for this?



This question was edited (previously I have trouble with docker-py library - it is solved now)





PREVIOUS QUESTION





I am trying to execute some ansible-playbook with docker container in Jenkins and I keep getting error...



I have in my Build stap : Invoke Ansible Playbook: and defined yml file.



Inside my yml file I have:



---
- hosts: localhost
vars:
git_branch: "{{ GIT_BRANCH|default('development') }}"
tasks:
- name: Log into Docker registry
docker_login:
registry_url: https://registry.docker....
username: user
password: ....


Then when I lunch Jenkins job I get :



PLAY [localhost] 
***************************************************************

TASK [setup]
*******************************************************************
ok: [localhost]

TASK [Log into Docker registry]
************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to import docker-py - No module named requests.exceptions. Try `pip install docker-py`"}
to retry, use: --limit @/var/jenkins_home/workspace/.../build_docker.retry


What is wrong here... do I need some plug-in or something?










share|improve this question

























  • The message says "Try pip install docker-py" - did you try that?

    – nwinkler
    Nov 27 '18 at 11:23











  • Yes,... But I have jenkins as a docker container,...

    – Marko Zadravec
    Nov 27 '18 at 11:24











  • Have you tried installing docker-py in there? On one of my RHEL VMs, I had to install the python-docker-py package via yum to make the Ansible Docker module work.

    – nwinkler
    Nov 27 '18 at 11:28











  • how to install python-docker-py to a running docker container?

    – Marko Zadravec
    Nov 27 '18 at 11:39











  • Since you're already using Ansible to do stuff in the container, why not install it via Ansible?

    – nwinkler
    Nov 27 '18 at 11:45
















0















I try to create docker image and put it into docker registry.



I have docker on server and running Jenkins image. (So Jenkins is a docker container)



Inside Jenkins I have job that should build image out of my code and put it in docker registry.



so




build_docker.yml




---
- hosts: localhost
vars:
git_branch: "{{ GIT_BRANCH|default('development') }}"
tasks:
- name: Log into Docker registry
docker_login:
registry_url: https://registry.docker....
username: user
password: ....


I get an error



TASK [Log into Docker registry] 
************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Error connecting: Error while fetching server API version: ('Connection aborted.', error(2, 'No such file or directory'))"}


I try to found what is wrong but I can found anything but:



answer



So my question is, it this error due to a missing docker inside docker container (Jenkins)? Or could be some other reason for this?



This question was edited (previously I have trouble with docker-py library - it is solved now)





PREVIOUS QUESTION





I am trying to execute some ansible-playbook with docker container in Jenkins and I keep getting error...



I have in my Build stap : Invoke Ansible Playbook: and defined yml file.



Inside my yml file I have:



---
- hosts: localhost
vars:
git_branch: "{{ GIT_BRANCH|default('development') }}"
tasks:
- name: Log into Docker registry
docker_login:
registry_url: https://registry.docker....
username: user
password: ....


Then when I lunch Jenkins job I get :



PLAY [localhost] 
***************************************************************

TASK [setup]
*******************************************************************
ok: [localhost]

TASK [Log into Docker registry]
************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to import docker-py - No module named requests.exceptions. Try `pip install docker-py`"}
to retry, use: --limit @/var/jenkins_home/workspace/.../build_docker.retry


What is wrong here... do I need some plug-in or something?










share|improve this question

























  • The message says "Try pip install docker-py" - did you try that?

    – nwinkler
    Nov 27 '18 at 11:23











  • Yes,... But I have jenkins as a docker container,...

    – Marko Zadravec
    Nov 27 '18 at 11:24











  • Have you tried installing docker-py in there? On one of my RHEL VMs, I had to install the python-docker-py package via yum to make the Ansible Docker module work.

    – nwinkler
    Nov 27 '18 at 11:28











  • how to install python-docker-py to a running docker container?

    – Marko Zadravec
    Nov 27 '18 at 11:39











  • Since you're already using Ansible to do stuff in the container, why not install it via Ansible?

    – nwinkler
    Nov 27 '18 at 11:45














0












0








0








I try to create docker image and put it into docker registry.



I have docker on server and running Jenkins image. (So Jenkins is a docker container)



Inside Jenkins I have job that should build image out of my code and put it in docker registry.



so




build_docker.yml




---
- hosts: localhost
vars:
git_branch: "{{ GIT_BRANCH|default('development') }}"
tasks:
- name: Log into Docker registry
docker_login:
registry_url: https://registry.docker....
username: user
password: ....


I get an error



TASK [Log into Docker registry] 
************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Error connecting: Error while fetching server API version: ('Connection aborted.', error(2, 'No such file or directory'))"}


I try to found what is wrong but I can found anything but:



answer



So my question is, it this error due to a missing docker inside docker container (Jenkins)? Or could be some other reason for this?



This question was edited (previously I have trouble with docker-py library - it is solved now)





PREVIOUS QUESTION





I am trying to execute some ansible-playbook with docker container in Jenkins and I keep getting error...



I have in my Build stap : Invoke Ansible Playbook: and defined yml file.



Inside my yml file I have:



---
- hosts: localhost
vars:
git_branch: "{{ GIT_BRANCH|default('development') }}"
tasks:
- name: Log into Docker registry
docker_login:
registry_url: https://registry.docker....
username: user
password: ....


Then when I lunch Jenkins job I get :



PLAY [localhost] 
***************************************************************

TASK [setup]
*******************************************************************
ok: [localhost]

TASK [Log into Docker registry]
************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to import docker-py - No module named requests.exceptions. Try `pip install docker-py`"}
to retry, use: --limit @/var/jenkins_home/workspace/.../build_docker.retry


What is wrong here... do I need some plug-in or something?










share|improve this question
















I try to create docker image and put it into docker registry.



I have docker on server and running Jenkins image. (So Jenkins is a docker container)



Inside Jenkins I have job that should build image out of my code and put it in docker registry.



so




build_docker.yml




---
- hosts: localhost
vars:
git_branch: "{{ GIT_BRANCH|default('development') }}"
tasks:
- name: Log into Docker registry
docker_login:
registry_url: https://registry.docker....
username: user
password: ....


I get an error



TASK [Log into Docker registry] 
************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Error connecting: Error while fetching server API version: ('Connection aborted.', error(2, 'No such file or directory'))"}


I try to found what is wrong but I can found anything but:



answer



So my question is, it this error due to a missing docker inside docker container (Jenkins)? Or could be some other reason for this?



This question was edited (previously I have trouble with docker-py library - it is solved now)





PREVIOUS QUESTION





I am trying to execute some ansible-playbook with docker container in Jenkins and I keep getting error...



I have in my Build stap : Invoke Ansible Playbook: and defined yml file.



Inside my yml file I have:



---
- hosts: localhost
vars:
git_branch: "{{ GIT_BRANCH|default('development') }}"
tasks:
- name: Log into Docker registry
docker_login:
registry_url: https://registry.docker....
username: user
password: ....


Then when I lunch Jenkins job I get :



PLAY [localhost] 
***************************************************************

TASK [setup]
*******************************************************************
ok: [localhost]

TASK [Log into Docker registry]
************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to import docker-py - No module named requests.exceptions. Try `pip install docker-py`"}
to retry, use: --limit @/var/jenkins_home/workspace/.../build_docker.retry


What is wrong here... do I need some plug-in or something?







python docker jenkins ansible docker-registry






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 27 '18 at 12:43







Marko Zadravec

















asked Nov 27 '18 at 11:04









Marko ZadravecMarko Zadravec

4,10052950




4,10052950













  • The message says "Try pip install docker-py" - did you try that?

    – nwinkler
    Nov 27 '18 at 11:23











  • Yes,... But I have jenkins as a docker container,...

    – Marko Zadravec
    Nov 27 '18 at 11:24











  • Have you tried installing docker-py in there? On one of my RHEL VMs, I had to install the python-docker-py package via yum to make the Ansible Docker module work.

    – nwinkler
    Nov 27 '18 at 11:28











  • how to install python-docker-py to a running docker container?

    – Marko Zadravec
    Nov 27 '18 at 11:39











  • Since you're already using Ansible to do stuff in the container, why not install it via Ansible?

    – nwinkler
    Nov 27 '18 at 11:45



















  • The message says "Try pip install docker-py" - did you try that?

    – nwinkler
    Nov 27 '18 at 11:23











  • Yes,... But I have jenkins as a docker container,...

    – Marko Zadravec
    Nov 27 '18 at 11:24











  • Have you tried installing docker-py in there? On one of my RHEL VMs, I had to install the python-docker-py package via yum to make the Ansible Docker module work.

    – nwinkler
    Nov 27 '18 at 11:28











  • how to install python-docker-py to a running docker container?

    – Marko Zadravec
    Nov 27 '18 at 11:39











  • Since you're already using Ansible to do stuff in the container, why not install it via Ansible?

    – nwinkler
    Nov 27 '18 at 11:45

















The message says "Try pip install docker-py" - did you try that?

– nwinkler
Nov 27 '18 at 11:23





The message says "Try pip install docker-py" - did you try that?

– nwinkler
Nov 27 '18 at 11:23













Yes,... But I have jenkins as a docker container,...

– Marko Zadravec
Nov 27 '18 at 11:24





Yes,... But I have jenkins as a docker container,...

– Marko Zadravec
Nov 27 '18 at 11:24













Have you tried installing docker-py in there? On one of my RHEL VMs, I had to install the python-docker-py package via yum to make the Ansible Docker module work.

– nwinkler
Nov 27 '18 at 11:28





Have you tried installing docker-py in there? On one of my RHEL VMs, I had to install the python-docker-py package via yum to make the Ansible Docker module work.

– nwinkler
Nov 27 '18 at 11:28













how to install python-docker-py to a running docker container?

– Marko Zadravec
Nov 27 '18 at 11:39





how to install python-docker-py to a running docker container?

– Marko Zadravec
Nov 27 '18 at 11:39













Since you're already using Ansible to do stuff in the container, why not install it via Ansible?

– nwinkler
Nov 27 '18 at 11:45





Since you're already using Ansible to do stuff in the container, why not install it via Ansible?

– nwinkler
Nov 27 '18 at 11:45












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53498269%2fjenkins-ansible-playbook-with-tag-docker-login-error%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53498269%2fjenkins-ansible-playbook-with-tag-docker-login-error%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks