getting Detected task failure for some images while creating docker service











up vote
0
down vote

favorite
1












I am trying to create docker swarm service, but I am getting some strange behavior:



For some images, it is successful and for some, I am getting an error:



docker service create nginx
89t21k3udf007pvl2ucvmdp9l
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged
--> Success



docker service create hello-world
8hhdki32ypfwshh2wvijkkmvb
overall progress: 0 out of 1 tasks
1/1: preparing [=================================> ]
verify: Detected task failure
--> Fail



For your reference: docker pull hello-world is working fine.



I was under impression that we can create services on all the images, is there any terms and conditions for that? Am I missing something?



Note: This is the basic part, but my main intention is to create service for local registry image. But upon debugging found issue in very first step i.e. hello-world.










share|improve this question






















  • You can get more details about your service using the docker service inspect hello-world and docker service ps hello-world --no-trunc. That should help you diagnose the problem.
    – Mehdi Yedes
    Nov 9 at 14:44










  • Can you create service for hello-world image?
    – user3721687
    Nov 9 at 17:39















up vote
0
down vote

favorite
1












I am trying to create docker swarm service, but I am getting some strange behavior:



For some images, it is successful and for some, I am getting an error:



docker service create nginx
89t21k3udf007pvl2ucvmdp9l
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged
--> Success



docker service create hello-world
8hhdki32ypfwshh2wvijkkmvb
overall progress: 0 out of 1 tasks
1/1: preparing [=================================> ]
verify: Detected task failure
--> Fail



For your reference: docker pull hello-world is working fine.



I was under impression that we can create services on all the images, is there any terms and conditions for that? Am I missing something?



Note: This is the basic part, but my main intention is to create service for local registry image. But upon debugging found issue in very first step i.e. hello-world.










share|improve this question






















  • You can get more details about your service using the docker service inspect hello-world and docker service ps hello-world --no-trunc. That should help you diagnose the problem.
    – Mehdi Yedes
    Nov 9 at 14:44










  • Can you create service for hello-world image?
    – user3721687
    Nov 9 at 17:39













up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





I am trying to create docker swarm service, but I am getting some strange behavior:



For some images, it is successful and for some, I am getting an error:



docker service create nginx
89t21k3udf007pvl2ucvmdp9l
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged
--> Success



docker service create hello-world
8hhdki32ypfwshh2wvijkkmvb
overall progress: 0 out of 1 tasks
1/1: preparing [=================================> ]
verify: Detected task failure
--> Fail



For your reference: docker pull hello-world is working fine.



I was under impression that we can create services on all the images, is there any terms and conditions for that? Am I missing something?



Note: This is the basic part, but my main intention is to create service for local registry image. But upon debugging found issue in very first step i.e. hello-world.










share|improve this question













I am trying to create docker swarm service, but I am getting some strange behavior:



For some images, it is successful and for some, I am getting an error:



docker service create nginx
89t21k3udf007pvl2ucvmdp9l
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged
--> Success



docker service create hello-world
8hhdki32ypfwshh2wvijkkmvb
overall progress: 0 out of 1 tasks
1/1: preparing [=================================> ]
verify: Detected task failure
--> Fail



For your reference: docker pull hello-world is working fine.



I was under impression that we can create services on all the images, is there any terms and conditions for that? Am I missing something?



Note: This is the basic part, but my main intention is to create service for local registry image. But upon debugging found issue in very first step i.e. hello-world.







docker docker-swarm docker-swarm-mode






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 9 at 8:55









user3721687

446




446












  • You can get more details about your service using the docker service inspect hello-world and docker service ps hello-world --no-trunc. That should help you diagnose the problem.
    – Mehdi Yedes
    Nov 9 at 14:44










  • Can you create service for hello-world image?
    – user3721687
    Nov 9 at 17:39


















  • You can get more details about your service using the docker service inspect hello-world and docker service ps hello-world --no-trunc. That should help you diagnose the problem.
    – Mehdi Yedes
    Nov 9 at 14:44










  • Can you create service for hello-world image?
    – user3721687
    Nov 9 at 17:39
















You can get more details about your service using the docker service inspect hello-world and docker service ps hello-world --no-trunc. That should help you diagnose the problem.
– Mehdi Yedes
Nov 9 at 14:44




You can get more details about your service using the docker service inspect hello-world and docker service ps hello-world --no-trunc. That should help you diagnose the problem.
– Mehdi Yedes
Nov 9 at 14:44












Can you create service for hello-world image?
– user3721687
Nov 9 at 17:39




Can you create service for hello-world image?
– user3721687
Nov 9 at 17:39












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










It is failing because the container created from the hello-world Docker image just displays a message and then exits, and that happens quickly.



And since you have created a swarm service, it will keep recreating the container everytime it fails, which is expected and that's why the service seems to be failing.



Please see below the service logs, and you will see that the container keeps being recreated:



[ ~]$ docker service create --name helloworld hello-world iilsd1yc706zgcdg35l8sdz3z
Since --detach=false was not specified, tasks will be created in the background.
In a future release, --detach=false will become the default.

[ ~]$ docker service logs helloworld -f
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ | Hello from Docker!
helloworld.1.zwyhf6x4cpdm@ | Hello from Docker!
helloworld.1.jxxnqzximfy7@ | This message shows that your installation appears to be working correctly.
helloworld.1.zwyhf6x4cpdm@ | This message shows that your installation appears to be working correctly.
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ |
helloworld.1.jxxnqzximfy7@ | To generate this message, Docker took the following steps:
helloworld.1.zwyhf6x4cpdm@ | To generate this message, Docker took the following steps:
helloworld.1.zwyhf6x4cpdm@ | 1. The Docker client contacted the Docker daemon.
helloworld.1.jxxnqzximfy7@ | 1. The Docker client contacted the Docker daemon.
helloworld.1.jxxnqzximfy7@ | 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
helloworld.1.zwyhf6x4cpdm@ | 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
helloworld.1.zwyhf6x4cpdm@ | (amd64)
helloworld.1.jxxnqzximfy7@ | (amd64)
helloworld.1.zwyhf6x4cpdm@ | 3. The Docker daemon created a new container from that image which runs the
helloworld.1.jxxnqzximfy7@ | 3. The Docker daemon created a new container from that image which runs the
helloworld.1.jxxnqzximfy7@ | executable that produces the output you are currently reading.
helloworld.1.zwyhf6x4cpdm@ | executable that produces the output you are currently reading.
helloworld.1.zwyhf6x4cpdm@ | 4. The Docker daemon streamed that output to the Docker client, which sent it
helloworld.1.jxxnqzximfy7@ | 4. The Docker daemon streamed that output to the Docker client, which sent it
helloworld.1.jxxnqzximfy7@ | to your terminal.
helloworld.1.zwyhf6x4cpdm@ | to your terminal.
helloworld.1.jxxnqzximfy7@ |
helloworld.1.jxxnqzximfy7@ | To try something more ambitious, you can run an Ubuntu container with:
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.zwyhf6x4cpdm@ | To try something more ambitious, you can run an Ubuntu container with:
helloworld.1.jxxnqzximfy7@ | $ docker run -it ubuntu bash
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | $ docker run -it ubuntu bash
helloworld.1.jxxnqzximfy7@ | Share images, automate workflows, and more with a free Docker ID:
helloworld.1.jxxnqzximfy7@ | https://hub.docker.com/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.zwyhf6x4cpdm@ | Share images, automate workflows, and more with a free Docker ID:
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | https://hub.docker.com/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ | For more examples and ideas, visit:
helloworld.1.jxxnqzximfy7@ | https://docs.docker.com/get-started/
helloworld.1.zwyhf6x4cpdm@ | For more examples and ideas, visit:
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | https://docs.docker.com/get-started/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.yw17ktyymrp6@ |
helloworld.1.yw17ktyymrp6@ | Hello from Docker!
helloworld.1.yw17ktyymrp6@ | This message shows that your installation appears to be working correctly.


You should try with a different Docker image, busybox for example:



[~]$ docker service create --name helloworld busybox:latest sh -c "while true; do echo Hello; sleep 2; done"
yjxzteshp7k2xf4aznj4l86s6
Since --detach=false was not specified, tasks will be created in the background.
In a future release, --detach=false will become the default.
[~]$ docker service ps helloworld --no-trunc
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
33xe78ekfjkmti8yahrcp5gug helloworld.1 busybox:latest@sha256:2a03a6059f21e150ae84b0973863609494aad70f0a80eaeb64bddd8d92465812 Running Running 1 second ago
[~]$ docker service logs -f helloworld
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
^C





share|improve this answer





















  • so if I want to use a image, then in compose yml file can I right /bin/bash in the command parameter, so that the image dont exists instantly and runs?
    – user3721687
    Nov 14 at 8:16










  • It depends on the Docker image. For example, the hello-world image doesn't include the /bin/bash binary. Below is the Dockerfile for that image: github.com/docker-library/hello-world/blob/… That's why I used the busybox image instead for the example.
    – Mehdi Yedes
    Nov 14 at 11:31










  • okay, got the thing you are mentioning, but why it is throwing error as Detected task failure? :/ it should run and end up instantly.
    – user3721687
    Nov 14 at 12:21










  • By default, when you create a swarm service, the desired state is to have 1 replica running at all times. So when your container finishes executing, the services spawns a new one right away. You can refer to the official documentation for a better understanding: docs.docker.com/engine/swarm/how-swarm-mode-works/services
    – Mehdi Yedes
    Nov 14 at 13:58










  • so can i use compose yml file to handle that version: '3' services: distcc-master: image: 192.168.1.12:5000/builddeps_essential-distcc-master command: /bin/bash distcc-worker: image: 192.168.1.12:5000/builddeps_essential-distcc-worker command: /bin/bash where image is the image from my registry and it is accessible
    – user3721687
    Nov 15 at 17:01











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',
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%2f53222530%2fgetting-detected-task-failure-for-some-images-while-creating-docker-service%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








up vote
1
down vote



accepted










It is failing because the container created from the hello-world Docker image just displays a message and then exits, and that happens quickly.



And since you have created a swarm service, it will keep recreating the container everytime it fails, which is expected and that's why the service seems to be failing.



Please see below the service logs, and you will see that the container keeps being recreated:



[ ~]$ docker service create --name helloworld hello-world iilsd1yc706zgcdg35l8sdz3z
Since --detach=false was not specified, tasks will be created in the background.
In a future release, --detach=false will become the default.

[ ~]$ docker service logs helloworld -f
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ | Hello from Docker!
helloworld.1.zwyhf6x4cpdm@ | Hello from Docker!
helloworld.1.jxxnqzximfy7@ | This message shows that your installation appears to be working correctly.
helloworld.1.zwyhf6x4cpdm@ | This message shows that your installation appears to be working correctly.
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ |
helloworld.1.jxxnqzximfy7@ | To generate this message, Docker took the following steps:
helloworld.1.zwyhf6x4cpdm@ | To generate this message, Docker took the following steps:
helloworld.1.zwyhf6x4cpdm@ | 1. The Docker client contacted the Docker daemon.
helloworld.1.jxxnqzximfy7@ | 1. The Docker client contacted the Docker daemon.
helloworld.1.jxxnqzximfy7@ | 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
helloworld.1.zwyhf6x4cpdm@ | 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
helloworld.1.zwyhf6x4cpdm@ | (amd64)
helloworld.1.jxxnqzximfy7@ | (amd64)
helloworld.1.zwyhf6x4cpdm@ | 3. The Docker daemon created a new container from that image which runs the
helloworld.1.jxxnqzximfy7@ | 3. The Docker daemon created a new container from that image which runs the
helloworld.1.jxxnqzximfy7@ | executable that produces the output you are currently reading.
helloworld.1.zwyhf6x4cpdm@ | executable that produces the output you are currently reading.
helloworld.1.zwyhf6x4cpdm@ | 4. The Docker daemon streamed that output to the Docker client, which sent it
helloworld.1.jxxnqzximfy7@ | 4. The Docker daemon streamed that output to the Docker client, which sent it
helloworld.1.jxxnqzximfy7@ | to your terminal.
helloworld.1.zwyhf6x4cpdm@ | to your terminal.
helloworld.1.jxxnqzximfy7@ |
helloworld.1.jxxnqzximfy7@ | To try something more ambitious, you can run an Ubuntu container with:
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.zwyhf6x4cpdm@ | To try something more ambitious, you can run an Ubuntu container with:
helloworld.1.jxxnqzximfy7@ | $ docker run -it ubuntu bash
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | $ docker run -it ubuntu bash
helloworld.1.jxxnqzximfy7@ | Share images, automate workflows, and more with a free Docker ID:
helloworld.1.jxxnqzximfy7@ | https://hub.docker.com/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.zwyhf6x4cpdm@ | Share images, automate workflows, and more with a free Docker ID:
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | https://hub.docker.com/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ | For more examples and ideas, visit:
helloworld.1.jxxnqzximfy7@ | https://docs.docker.com/get-started/
helloworld.1.zwyhf6x4cpdm@ | For more examples and ideas, visit:
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | https://docs.docker.com/get-started/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.yw17ktyymrp6@ |
helloworld.1.yw17ktyymrp6@ | Hello from Docker!
helloworld.1.yw17ktyymrp6@ | This message shows that your installation appears to be working correctly.


You should try with a different Docker image, busybox for example:



[~]$ docker service create --name helloworld busybox:latest sh -c "while true; do echo Hello; sleep 2; done"
yjxzteshp7k2xf4aznj4l86s6
Since --detach=false was not specified, tasks will be created in the background.
In a future release, --detach=false will become the default.
[~]$ docker service ps helloworld --no-trunc
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
33xe78ekfjkmti8yahrcp5gug helloworld.1 busybox:latest@sha256:2a03a6059f21e150ae84b0973863609494aad70f0a80eaeb64bddd8d92465812 Running Running 1 second ago
[~]$ docker service logs -f helloworld
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
^C





share|improve this answer





















  • so if I want to use a image, then in compose yml file can I right /bin/bash in the command parameter, so that the image dont exists instantly and runs?
    – user3721687
    Nov 14 at 8:16










  • It depends on the Docker image. For example, the hello-world image doesn't include the /bin/bash binary. Below is the Dockerfile for that image: github.com/docker-library/hello-world/blob/… That's why I used the busybox image instead for the example.
    – Mehdi Yedes
    Nov 14 at 11:31










  • okay, got the thing you are mentioning, but why it is throwing error as Detected task failure? :/ it should run and end up instantly.
    – user3721687
    Nov 14 at 12:21










  • By default, when you create a swarm service, the desired state is to have 1 replica running at all times. So when your container finishes executing, the services spawns a new one right away. You can refer to the official documentation for a better understanding: docs.docker.com/engine/swarm/how-swarm-mode-works/services
    – Mehdi Yedes
    Nov 14 at 13:58










  • so can i use compose yml file to handle that version: '3' services: distcc-master: image: 192.168.1.12:5000/builddeps_essential-distcc-master command: /bin/bash distcc-worker: image: 192.168.1.12:5000/builddeps_essential-distcc-worker command: /bin/bash where image is the image from my registry and it is accessible
    – user3721687
    Nov 15 at 17:01















up vote
1
down vote



accepted










It is failing because the container created from the hello-world Docker image just displays a message and then exits, and that happens quickly.



And since you have created a swarm service, it will keep recreating the container everytime it fails, which is expected and that's why the service seems to be failing.



Please see below the service logs, and you will see that the container keeps being recreated:



[ ~]$ docker service create --name helloworld hello-world iilsd1yc706zgcdg35l8sdz3z
Since --detach=false was not specified, tasks will be created in the background.
In a future release, --detach=false will become the default.

[ ~]$ docker service logs helloworld -f
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ | Hello from Docker!
helloworld.1.zwyhf6x4cpdm@ | Hello from Docker!
helloworld.1.jxxnqzximfy7@ | This message shows that your installation appears to be working correctly.
helloworld.1.zwyhf6x4cpdm@ | This message shows that your installation appears to be working correctly.
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ |
helloworld.1.jxxnqzximfy7@ | To generate this message, Docker took the following steps:
helloworld.1.zwyhf6x4cpdm@ | To generate this message, Docker took the following steps:
helloworld.1.zwyhf6x4cpdm@ | 1. The Docker client contacted the Docker daemon.
helloworld.1.jxxnqzximfy7@ | 1. The Docker client contacted the Docker daemon.
helloworld.1.jxxnqzximfy7@ | 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
helloworld.1.zwyhf6x4cpdm@ | 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
helloworld.1.zwyhf6x4cpdm@ | (amd64)
helloworld.1.jxxnqzximfy7@ | (amd64)
helloworld.1.zwyhf6x4cpdm@ | 3. The Docker daemon created a new container from that image which runs the
helloworld.1.jxxnqzximfy7@ | 3. The Docker daemon created a new container from that image which runs the
helloworld.1.jxxnqzximfy7@ | executable that produces the output you are currently reading.
helloworld.1.zwyhf6x4cpdm@ | executable that produces the output you are currently reading.
helloworld.1.zwyhf6x4cpdm@ | 4. The Docker daemon streamed that output to the Docker client, which sent it
helloworld.1.jxxnqzximfy7@ | 4. The Docker daemon streamed that output to the Docker client, which sent it
helloworld.1.jxxnqzximfy7@ | to your terminal.
helloworld.1.zwyhf6x4cpdm@ | to your terminal.
helloworld.1.jxxnqzximfy7@ |
helloworld.1.jxxnqzximfy7@ | To try something more ambitious, you can run an Ubuntu container with:
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.zwyhf6x4cpdm@ | To try something more ambitious, you can run an Ubuntu container with:
helloworld.1.jxxnqzximfy7@ | $ docker run -it ubuntu bash
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | $ docker run -it ubuntu bash
helloworld.1.jxxnqzximfy7@ | Share images, automate workflows, and more with a free Docker ID:
helloworld.1.jxxnqzximfy7@ | https://hub.docker.com/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.zwyhf6x4cpdm@ | Share images, automate workflows, and more with a free Docker ID:
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | https://hub.docker.com/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ | For more examples and ideas, visit:
helloworld.1.jxxnqzximfy7@ | https://docs.docker.com/get-started/
helloworld.1.zwyhf6x4cpdm@ | For more examples and ideas, visit:
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | https://docs.docker.com/get-started/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.yw17ktyymrp6@ |
helloworld.1.yw17ktyymrp6@ | Hello from Docker!
helloworld.1.yw17ktyymrp6@ | This message shows that your installation appears to be working correctly.


You should try with a different Docker image, busybox for example:



[~]$ docker service create --name helloworld busybox:latest sh -c "while true; do echo Hello; sleep 2; done"
yjxzteshp7k2xf4aznj4l86s6
Since --detach=false was not specified, tasks will be created in the background.
In a future release, --detach=false will become the default.
[~]$ docker service ps helloworld --no-trunc
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
33xe78ekfjkmti8yahrcp5gug helloworld.1 busybox:latest@sha256:2a03a6059f21e150ae84b0973863609494aad70f0a80eaeb64bddd8d92465812 Running Running 1 second ago
[~]$ docker service logs -f helloworld
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
^C





share|improve this answer





















  • so if I want to use a image, then in compose yml file can I right /bin/bash in the command parameter, so that the image dont exists instantly and runs?
    – user3721687
    Nov 14 at 8:16










  • It depends on the Docker image. For example, the hello-world image doesn't include the /bin/bash binary. Below is the Dockerfile for that image: github.com/docker-library/hello-world/blob/… That's why I used the busybox image instead for the example.
    – Mehdi Yedes
    Nov 14 at 11:31










  • okay, got the thing you are mentioning, but why it is throwing error as Detected task failure? :/ it should run and end up instantly.
    – user3721687
    Nov 14 at 12:21










  • By default, when you create a swarm service, the desired state is to have 1 replica running at all times. So when your container finishes executing, the services spawns a new one right away. You can refer to the official documentation for a better understanding: docs.docker.com/engine/swarm/how-swarm-mode-works/services
    – Mehdi Yedes
    Nov 14 at 13:58










  • so can i use compose yml file to handle that version: '3' services: distcc-master: image: 192.168.1.12:5000/builddeps_essential-distcc-master command: /bin/bash distcc-worker: image: 192.168.1.12:5000/builddeps_essential-distcc-worker command: /bin/bash where image is the image from my registry and it is accessible
    – user3721687
    Nov 15 at 17:01













up vote
1
down vote



accepted







up vote
1
down vote



accepted






It is failing because the container created from the hello-world Docker image just displays a message and then exits, and that happens quickly.



And since you have created a swarm service, it will keep recreating the container everytime it fails, which is expected and that's why the service seems to be failing.



Please see below the service logs, and you will see that the container keeps being recreated:



[ ~]$ docker service create --name helloworld hello-world iilsd1yc706zgcdg35l8sdz3z
Since --detach=false was not specified, tasks will be created in the background.
In a future release, --detach=false will become the default.

[ ~]$ docker service logs helloworld -f
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ | Hello from Docker!
helloworld.1.zwyhf6x4cpdm@ | Hello from Docker!
helloworld.1.jxxnqzximfy7@ | This message shows that your installation appears to be working correctly.
helloworld.1.zwyhf6x4cpdm@ | This message shows that your installation appears to be working correctly.
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ |
helloworld.1.jxxnqzximfy7@ | To generate this message, Docker took the following steps:
helloworld.1.zwyhf6x4cpdm@ | To generate this message, Docker took the following steps:
helloworld.1.zwyhf6x4cpdm@ | 1. The Docker client contacted the Docker daemon.
helloworld.1.jxxnqzximfy7@ | 1. The Docker client contacted the Docker daemon.
helloworld.1.jxxnqzximfy7@ | 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
helloworld.1.zwyhf6x4cpdm@ | 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
helloworld.1.zwyhf6x4cpdm@ | (amd64)
helloworld.1.jxxnqzximfy7@ | (amd64)
helloworld.1.zwyhf6x4cpdm@ | 3. The Docker daemon created a new container from that image which runs the
helloworld.1.jxxnqzximfy7@ | 3. The Docker daemon created a new container from that image which runs the
helloworld.1.jxxnqzximfy7@ | executable that produces the output you are currently reading.
helloworld.1.zwyhf6x4cpdm@ | executable that produces the output you are currently reading.
helloworld.1.zwyhf6x4cpdm@ | 4. The Docker daemon streamed that output to the Docker client, which sent it
helloworld.1.jxxnqzximfy7@ | 4. The Docker daemon streamed that output to the Docker client, which sent it
helloworld.1.jxxnqzximfy7@ | to your terminal.
helloworld.1.zwyhf6x4cpdm@ | to your terminal.
helloworld.1.jxxnqzximfy7@ |
helloworld.1.jxxnqzximfy7@ | To try something more ambitious, you can run an Ubuntu container with:
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.zwyhf6x4cpdm@ | To try something more ambitious, you can run an Ubuntu container with:
helloworld.1.jxxnqzximfy7@ | $ docker run -it ubuntu bash
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | $ docker run -it ubuntu bash
helloworld.1.jxxnqzximfy7@ | Share images, automate workflows, and more with a free Docker ID:
helloworld.1.jxxnqzximfy7@ | https://hub.docker.com/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.zwyhf6x4cpdm@ | Share images, automate workflows, and more with a free Docker ID:
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | https://hub.docker.com/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ | For more examples and ideas, visit:
helloworld.1.jxxnqzximfy7@ | https://docs.docker.com/get-started/
helloworld.1.zwyhf6x4cpdm@ | For more examples and ideas, visit:
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | https://docs.docker.com/get-started/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.yw17ktyymrp6@ |
helloworld.1.yw17ktyymrp6@ | Hello from Docker!
helloworld.1.yw17ktyymrp6@ | This message shows that your installation appears to be working correctly.


You should try with a different Docker image, busybox for example:



[~]$ docker service create --name helloworld busybox:latest sh -c "while true; do echo Hello; sleep 2; done"
yjxzteshp7k2xf4aznj4l86s6
Since --detach=false was not specified, tasks will be created in the background.
In a future release, --detach=false will become the default.
[~]$ docker service ps helloworld --no-trunc
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
33xe78ekfjkmti8yahrcp5gug helloworld.1 busybox:latest@sha256:2a03a6059f21e150ae84b0973863609494aad70f0a80eaeb64bddd8d92465812 Running Running 1 second ago
[~]$ docker service logs -f helloworld
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
^C





share|improve this answer












It is failing because the container created from the hello-world Docker image just displays a message and then exits, and that happens quickly.



And since you have created a swarm service, it will keep recreating the container everytime it fails, which is expected and that's why the service seems to be failing.



Please see below the service logs, and you will see that the container keeps being recreated:



[ ~]$ docker service create --name helloworld hello-world iilsd1yc706zgcdg35l8sdz3z
Since --detach=false was not specified, tasks will be created in the background.
In a future release, --detach=false will become the default.

[ ~]$ docker service logs helloworld -f
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ | Hello from Docker!
helloworld.1.zwyhf6x4cpdm@ | Hello from Docker!
helloworld.1.jxxnqzximfy7@ | This message shows that your installation appears to be working correctly.
helloworld.1.zwyhf6x4cpdm@ | This message shows that your installation appears to be working correctly.
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ |
helloworld.1.jxxnqzximfy7@ | To generate this message, Docker took the following steps:
helloworld.1.zwyhf6x4cpdm@ | To generate this message, Docker took the following steps:
helloworld.1.zwyhf6x4cpdm@ | 1. The Docker client contacted the Docker daemon.
helloworld.1.jxxnqzximfy7@ | 1. The Docker client contacted the Docker daemon.
helloworld.1.jxxnqzximfy7@ | 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
helloworld.1.zwyhf6x4cpdm@ | 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
helloworld.1.zwyhf6x4cpdm@ | (amd64)
helloworld.1.jxxnqzximfy7@ | (amd64)
helloworld.1.zwyhf6x4cpdm@ | 3. The Docker daemon created a new container from that image which runs the
helloworld.1.jxxnqzximfy7@ | 3. The Docker daemon created a new container from that image which runs the
helloworld.1.jxxnqzximfy7@ | executable that produces the output you are currently reading.
helloworld.1.zwyhf6x4cpdm@ | executable that produces the output you are currently reading.
helloworld.1.zwyhf6x4cpdm@ | 4. The Docker daemon streamed that output to the Docker client, which sent it
helloworld.1.jxxnqzximfy7@ | 4. The Docker daemon streamed that output to the Docker client, which sent it
helloworld.1.jxxnqzximfy7@ | to your terminal.
helloworld.1.zwyhf6x4cpdm@ | to your terminal.
helloworld.1.jxxnqzximfy7@ |
helloworld.1.jxxnqzximfy7@ | To try something more ambitious, you can run an Ubuntu container with:
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.zwyhf6x4cpdm@ | To try something more ambitious, you can run an Ubuntu container with:
helloworld.1.jxxnqzximfy7@ | $ docker run -it ubuntu bash
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | $ docker run -it ubuntu bash
helloworld.1.jxxnqzximfy7@ | Share images, automate workflows, and more with a free Docker ID:
helloworld.1.jxxnqzximfy7@ | https://hub.docker.com/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.zwyhf6x4cpdm@ | Share images, automate workflows, and more with a free Docker ID:
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | https://hub.docker.com/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.jxxnqzximfy7@ | For more examples and ideas, visit:
helloworld.1.jxxnqzximfy7@ | https://docs.docker.com/get-started/
helloworld.1.zwyhf6x4cpdm@ | For more examples and ideas, visit:
helloworld.1.jxxnqzximfy7@ |
helloworld.1.zwyhf6x4cpdm@ | https://docs.docker.com/get-started/
helloworld.1.zwyhf6x4cpdm@ |
helloworld.1.yw17ktyymrp6@ |
helloworld.1.yw17ktyymrp6@ | Hello from Docker!
helloworld.1.yw17ktyymrp6@ | This message shows that your installation appears to be working correctly.


You should try with a different Docker image, busybox for example:



[~]$ docker service create --name helloworld busybox:latest sh -c "while true; do echo Hello; sleep 2; done"
yjxzteshp7k2xf4aznj4l86s6
Since --detach=false was not specified, tasks will be created in the background.
In a future release, --detach=false will become the default.
[~]$ docker service ps helloworld --no-trunc
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
33xe78ekfjkmti8yahrcp5gug helloworld.1 busybox:latest@sha256:2a03a6059f21e150ae84b0973863609494aad70f0a80eaeb64bddd8d92465812 Running Running 1 second ago
[~]$ docker service logs -f helloworld
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
helloworld.1.33xe78ekfjkm@ | Hello
^C






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 at 10:34









Mehdi Yedes

915813




915813












  • so if I want to use a image, then in compose yml file can I right /bin/bash in the command parameter, so that the image dont exists instantly and runs?
    – user3721687
    Nov 14 at 8:16










  • It depends on the Docker image. For example, the hello-world image doesn't include the /bin/bash binary. Below is the Dockerfile for that image: github.com/docker-library/hello-world/blob/… That's why I used the busybox image instead for the example.
    – Mehdi Yedes
    Nov 14 at 11:31










  • okay, got the thing you are mentioning, but why it is throwing error as Detected task failure? :/ it should run and end up instantly.
    – user3721687
    Nov 14 at 12:21










  • By default, when you create a swarm service, the desired state is to have 1 replica running at all times. So when your container finishes executing, the services spawns a new one right away. You can refer to the official documentation for a better understanding: docs.docker.com/engine/swarm/how-swarm-mode-works/services
    – Mehdi Yedes
    Nov 14 at 13:58










  • so can i use compose yml file to handle that version: '3' services: distcc-master: image: 192.168.1.12:5000/builddeps_essential-distcc-master command: /bin/bash distcc-worker: image: 192.168.1.12:5000/builddeps_essential-distcc-worker command: /bin/bash where image is the image from my registry and it is accessible
    – user3721687
    Nov 15 at 17:01


















  • so if I want to use a image, then in compose yml file can I right /bin/bash in the command parameter, so that the image dont exists instantly and runs?
    – user3721687
    Nov 14 at 8:16










  • It depends on the Docker image. For example, the hello-world image doesn't include the /bin/bash binary. Below is the Dockerfile for that image: github.com/docker-library/hello-world/blob/… That's why I used the busybox image instead for the example.
    – Mehdi Yedes
    Nov 14 at 11:31










  • okay, got the thing you are mentioning, but why it is throwing error as Detected task failure? :/ it should run and end up instantly.
    – user3721687
    Nov 14 at 12:21










  • By default, when you create a swarm service, the desired state is to have 1 replica running at all times. So when your container finishes executing, the services spawns a new one right away. You can refer to the official documentation for a better understanding: docs.docker.com/engine/swarm/how-swarm-mode-works/services
    – Mehdi Yedes
    Nov 14 at 13:58










  • so can i use compose yml file to handle that version: '3' services: distcc-master: image: 192.168.1.12:5000/builddeps_essential-distcc-master command: /bin/bash distcc-worker: image: 192.168.1.12:5000/builddeps_essential-distcc-worker command: /bin/bash where image is the image from my registry and it is accessible
    – user3721687
    Nov 15 at 17:01
















so if I want to use a image, then in compose yml file can I right /bin/bash in the command parameter, so that the image dont exists instantly and runs?
– user3721687
Nov 14 at 8:16




so if I want to use a image, then in compose yml file can I right /bin/bash in the command parameter, so that the image dont exists instantly and runs?
– user3721687
Nov 14 at 8:16












It depends on the Docker image. For example, the hello-world image doesn't include the /bin/bash binary. Below is the Dockerfile for that image: github.com/docker-library/hello-world/blob/… That's why I used the busybox image instead for the example.
– Mehdi Yedes
Nov 14 at 11:31




It depends on the Docker image. For example, the hello-world image doesn't include the /bin/bash binary. Below is the Dockerfile for that image: github.com/docker-library/hello-world/blob/… That's why I used the busybox image instead for the example.
– Mehdi Yedes
Nov 14 at 11:31












okay, got the thing you are mentioning, but why it is throwing error as Detected task failure? :/ it should run and end up instantly.
– user3721687
Nov 14 at 12:21




okay, got the thing you are mentioning, but why it is throwing error as Detected task failure? :/ it should run and end up instantly.
– user3721687
Nov 14 at 12:21












By default, when you create a swarm service, the desired state is to have 1 replica running at all times. So when your container finishes executing, the services spawns a new one right away. You can refer to the official documentation for a better understanding: docs.docker.com/engine/swarm/how-swarm-mode-works/services
– Mehdi Yedes
Nov 14 at 13:58




By default, when you create a swarm service, the desired state is to have 1 replica running at all times. So when your container finishes executing, the services spawns a new one right away. You can refer to the official documentation for a better understanding: docs.docker.com/engine/swarm/how-swarm-mode-works/services
– Mehdi Yedes
Nov 14 at 13:58












so can i use compose yml file to handle that version: '3' services: distcc-master: image: 192.168.1.12:5000/builddeps_essential-distcc-master command: /bin/bash distcc-worker: image: 192.168.1.12:5000/builddeps_essential-distcc-worker command: /bin/bash where image is the image from my registry and it is accessible
– user3721687
Nov 15 at 17:01




so can i use compose yml file to handle that version: '3' services: distcc-master: image: 192.168.1.12:5000/builddeps_essential-distcc-master command: /bin/bash distcc-worker: image: 192.168.1.12:5000/builddeps_essential-distcc-worker command: /bin/bash where image is the image from my registry and it is accessible
– user3721687
Nov 15 at 17:01


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53222530%2fgetting-detected-task-failure-for-some-images-while-creating-docker-service%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

鏡平學校

ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

Why https connections are so slow when debugging (stepping over) in Java?