“Can not connect to Docker Daemon”
I have a project in which I need to use CircleCi to build a docker application image, and then upload it to the Amazon container repository.
Given that CircleCI also runs on Docker, I created a Docker image for it, which containers a version of Ubuntu, together with AWS CLI, Node and Docker. See Dockerfile below:
FROM ubuntu:16.04
# update libraries
RUN apt-get update
RUN apt-get install -y apt-transport-https ca-certificates curl software-properties-common
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# install docker
RUN apt-get update
RUN apt-cache policy docker-ce
RUN apt-get install -y docker-ce
# <---
RUN systemctl status docker # <--- TROUBLE HERE
# <---
# install node
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt install -y nodejs
# install aws cli
RUN apt-get install -y python-pip python-dev build-essential
RUN pip install --upgrade pip
RUN pip install awscli --upgrade
I am currently having some problems working with this CircleCi docker image, because, if i keep the command RUN systemctl status docker
I get the following error:
Failed to connect to bus: No such file or directory The command '/bin/sh -c systemctl status docker' returned a non-zero code: 1
If, on the other, I remove that command, the build is sucessful. However, when I go inside docker sudo docker run -it unad16
and run any docker command, as, f.e., docker images
, I get the following error:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I have been trying to debug this error since yesterday, but have been unsucessfull. Thus, any help would be truly appreciated.
Notes:
- the "daemon" error occurs even when I run docker in priviled mode with
sudo docker run -ti --privileged=true unad16
docker
add a comment |
I have a project in which I need to use CircleCi to build a docker application image, and then upload it to the Amazon container repository.
Given that CircleCI also runs on Docker, I created a Docker image for it, which containers a version of Ubuntu, together with AWS CLI, Node and Docker. See Dockerfile below:
FROM ubuntu:16.04
# update libraries
RUN apt-get update
RUN apt-get install -y apt-transport-https ca-certificates curl software-properties-common
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# install docker
RUN apt-get update
RUN apt-cache policy docker-ce
RUN apt-get install -y docker-ce
# <---
RUN systemctl status docker # <--- TROUBLE HERE
# <---
# install node
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt install -y nodejs
# install aws cli
RUN apt-get install -y python-pip python-dev build-essential
RUN pip install --upgrade pip
RUN pip install awscli --upgrade
I am currently having some problems working with this CircleCi docker image, because, if i keep the command RUN systemctl status docker
I get the following error:
Failed to connect to bus: No such file or directory The command '/bin/sh -c systemctl status docker' returned a non-zero code: 1
If, on the other, I remove that command, the build is sucessful. However, when I go inside docker sudo docker run -it unad16
and run any docker command, as, f.e., docker images
, I get the following error:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I have been trying to debug this error since yesterday, but have been unsucessfull. Thus, any help would be truly appreciated.
Notes:
- the "daemon" error occurs even when I run docker in priviled mode with
sudo docker run -ti --privileged=true unad16
docker
add a comment |
I have a project in which I need to use CircleCi to build a docker application image, and then upload it to the Amazon container repository.
Given that CircleCI also runs on Docker, I created a Docker image for it, which containers a version of Ubuntu, together with AWS CLI, Node and Docker. See Dockerfile below:
FROM ubuntu:16.04
# update libraries
RUN apt-get update
RUN apt-get install -y apt-transport-https ca-certificates curl software-properties-common
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# install docker
RUN apt-get update
RUN apt-cache policy docker-ce
RUN apt-get install -y docker-ce
# <---
RUN systemctl status docker # <--- TROUBLE HERE
# <---
# install node
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt install -y nodejs
# install aws cli
RUN apt-get install -y python-pip python-dev build-essential
RUN pip install --upgrade pip
RUN pip install awscli --upgrade
I am currently having some problems working with this CircleCi docker image, because, if i keep the command RUN systemctl status docker
I get the following error:
Failed to connect to bus: No such file or directory The command '/bin/sh -c systemctl status docker' returned a non-zero code: 1
If, on the other, I remove that command, the build is sucessful. However, when I go inside docker sudo docker run -it unad16
and run any docker command, as, f.e., docker images
, I get the following error:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I have been trying to debug this error since yesterday, but have been unsucessfull. Thus, any help would be truly appreciated.
Notes:
- the "daemon" error occurs even when I run docker in priviled mode with
sudo docker run -ti --privileged=true unad16
docker
I have a project in which I need to use CircleCi to build a docker application image, and then upload it to the Amazon container repository.
Given that CircleCI also runs on Docker, I created a Docker image for it, which containers a version of Ubuntu, together with AWS CLI, Node and Docker. See Dockerfile below:
FROM ubuntu:16.04
# update libraries
RUN apt-get update
RUN apt-get install -y apt-transport-https ca-certificates curl software-properties-common
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# install docker
RUN apt-get update
RUN apt-cache policy docker-ce
RUN apt-get install -y docker-ce
# <---
RUN systemctl status docker # <--- TROUBLE HERE
# <---
# install node
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt install -y nodejs
# install aws cli
RUN apt-get install -y python-pip python-dev build-essential
RUN pip install --upgrade pip
RUN pip install awscli --upgrade
I am currently having some problems working with this CircleCi docker image, because, if i keep the command RUN systemctl status docker
I get the following error:
Failed to connect to bus: No such file or directory The command '/bin/sh -c systemctl status docker' returned a non-zero code: 1
If, on the other, I remove that command, the build is sucessful. However, when I go inside docker sudo docker run -it unad16
and run any docker command, as, f.e., docker images
, I get the following error:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I have been trying to debug this error since yesterday, but have been unsucessfull. Thus, any help would be truly appreciated.
Notes:
- the "daemon" error occurs even when I run docker in priviled mode with
sudo docker run -ti --privileged=true unad16
docker
docker
edited Nov 22 '18 at 10:28
tgogos
6,38674081
6,38674081
asked Nov 22 '18 at 10:19
Rafael MarquesRafael Marques
107111
107111
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You don't need to run a docker daemon if you want to build a docker image in circleci. Instead you just need an image with docker client, and a circle config with - setup_remote_docker
.
Read more in
https://circleci.com/docs/2.0/building-docker-images/
If for some other reason you still want to run a docker service in a docker image, please refer to DockerInDocker repo, especially the README.md part.
This was very useful, thank you. I have a follow up question, maybe you can also help me with that. Even when using "setup_remote_docker", you still must pass it a Docker image that contains the relevant commands, including Docker, correct? F.e., when you pass a Docker image with only Node.Js, and it tries to run the docker build commands, it will throw an error saying "docker not found"
– Rafael Marques
Nov 22 '18 at 11:06
Yes, you need a docker client in your image to connect to the remote docker, but you don't need to run the actual daemon service.
– William Chong
Nov 22 '18 at 11:09
Great, thank you for your help, I will accept the answer as it solved the problem. Cheers.
– Rafael Marques
Nov 22 '18 at 11:12
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53428701%2fcan-not-connect-to-docker-daemon%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You don't need to run a docker daemon if you want to build a docker image in circleci. Instead you just need an image with docker client, and a circle config with - setup_remote_docker
.
Read more in
https://circleci.com/docs/2.0/building-docker-images/
If for some other reason you still want to run a docker service in a docker image, please refer to DockerInDocker repo, especially the README.md part.
This was very useful, thank you. I have a follow up question, maybe you can also help me with that. Even when using "setup_remote_docker", you still must pass it a Docker image that contains the relevant commands, including Docker, correct? F.e., when you pass a Docker image with only Node.Js, and it tries to run the docker build commands, it will throw an error saying "docker not found"
– Rafael Marques
Nov 22 '18 at 11:06
Yes, you need a docker client in your image to connect to the remote docker, but you don't need to run the actual daemon service.
– William Chong
Nov 22 '18 at 11:09
Great, thank you for your help, I will accept the answer as it solved the problem. Cheers.
– Rafael Marques
Nov 22 '18 at 11:12
add a comment |
You don't need to run a docker daemon if you want to build a docker image in circleci. Instead you just need an image with docker client, and a circle config with - setup_remote_docker
.
Read more in
https://circleci.com/docs/2.0/building-docker-images/
If for some other reason you still want to run a docker service in a docker image, please refer to DockerInDocker repo, especially the README.md part.
This was very useful, thank you. I have a follow up question, maybe you can also help me with that. Even when using "setup_remote_docker", you still must pass it a Docker image that contains the relevant commands, including Docker, correct? F.e., when you pass a Docker image with only Node.Js, and it tries to run the docker build commands, it will throw an error saying "docker not found"
– Rafael Marques
Nov 22 '18 at 11:06
Yes, you need a docker client in your image to connect to the remote docker, but you don't need to run the actual daemon service.
– William Chong
Nov 22 '18 at 11:09
Great, thank you for your help, I will accept the answer as it solved the problem. Cheers.
– Rafael Marques
Nov 22 '18 at 11:12
add a comment |
You don't need to run a docker daemon if you want to build a docker image in circleci. Instead you just need an image with docker client, and a circle config with - setup_remote_docker
.
Read more in
https://circleci.com/docs/2.0/building-docker-images/
If for some other reason you still want to run a docker service in a docker image, please refer to DockerInDocker repo, especially the README.md part.
You don't need to run a docker daemon if you want to build a docker image in circleci. Instead you just need an image with docker client, and a circle config with - setup_remote_docker
.
Read more in
https://circleci.com/docs/2.0/building-docker-images/
If for some other reason you still want to run a docker service in a docker image, please refer to DockerInDocker repo, especially the README.md part.
answered Nov 22 '18 at 10:27


William ChongWilliam Chong
929416
929416
This was very useful, thank you. I have a follow up question, maybe you can also help me with that. Even when using "setup_remote_docker", you still must pass it a Docker image that contains the relevant commands, including Docker, correct? F.e., when you pass a Docker image with only Node.Js, and it tries to run the docker build commands, it will throw an error saying "docker not found"
– Rafael Marques
Nov 22 '18 at 11:06
Yes, you need a docker client in your image to connect to the remote docker, but you don't need to run the actual daemon service.
– William Chong
Nov 22 '18 at 11:09
Great, thank you for your help, I will accept the answer as it solved the problem. Cheers.
– Rafael Marques
Nov 22 '18 at 11:12
add a comment |
This was very useful, thank you. I have a follow up question, maybe you can also help me with that. Even when using "setup_remote_docker", you still must pass it a Docker image that contains the relevant commands, including Docker, correct? F.e., when you pass a Docker image with only Node.Js, and it tries to run the docker build commands, it will throw an error saying "docker not found"
– Rafael Marques
Nov 22 '18 at 11:06
Yes, you need a docker client in your image to connect to the remote docker, but you don't need to run the actual daemon service.
– William Chong
Nov 22 '18 at 11:09
Great, thank you for your help, I will accept the answer as it solved the problem. Cheers.
– Rafael Marques
Nov 22 '18 at 11:12
This was very useful, thank you. I have a follow up question, maybe you can also help me with that. Even when using "setup_remote_docker", you still must pass it a Docker image that contains the relevant commands, including Docker, correct? F.e., when you pass a Docker image with only Node.Js, and it tries to run the docker build commands, it will throw an error saying "docker not found"
– Rafael Marques
Nov 22 '18 at 11:06
This was very useful, thank you. I have a follow up question, maybe you can also help me with that. Even when using "setup_remote_docker", you still must pass it a Docker image that contains the relevant commands, including Docker, correct? F.e., when you pass a Docker image with only Node.Js, and it tries to run the docker build commands, it will throw an error saying "docker not found"
– Rafael Marques
Nov 22 '18 at 11:06
Yes, you need a docker client in your image to connect to the remote docker, but you don't need to run the actual daemon service.
– William Chong
Nov 22 '18 at 11:09
Yes, you need a docker client in your image to connect to the remote docker, but you don't need to run the actual daemon service.
– William Chong
Nov 22 '18 at 11:09
Great, thank you for your help, I will accept the answer as it solved the problem. Cheers.
– Rafael Marques
Nov 22 '18 at 11:12
Great, thank you for your help, I will accept the answer as it solved the problem. Cheers.
– Rafael Marques
Nov 22 '18 at 11:12
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53428701%2fcan-not-connect-to-docker-daemon%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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