Docker Community Forums

Share and learn in the Docker community.

Swarm service cant use local images [1.12.2]

i am running a server with debian jessie and docker 1.12.2 on it. when i build images locally i cant use them by creating a service. as far as i know, it should be the default to first check if the image is locally available?
struggling with this issue more than a day and have no plan how to get rid of it!

someone have a solution or an advise?

here some logs:

# docker version
Client:
 Version:      1.12.2
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   bb80604
 Built:        Tue Oct 11 17:43:41 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.2
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   bb80604
 Built:        Tue Oct 11 17:43:41 2016
 OS/Arch:      linux/amd64

# docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
couchbase450ee       latest              72043aded28a        38 minutes ago      1.218 GB
fan/couchbase450ee   0.4                 72043aded28a        38 minutes ago      1.218 GB
fan/couchbase450ee   latest              72043aded28a        38 minutes ago      1.218 GB
fan/couchbase        latest              72043aded28a        38 minutes ago      1.218 GB
couchbase            latest              c62ee511b6d1        3 days ago          569 MB
buildpack-deps       jessie              91a1c74dd9b0        3 weeks ago         611.2 MB

# journalctl -xeu docker.service
error msg="Handler for POST /v1.24/containers/create returned error: No such image: fan/couchbase450ee:latest"
error msg="Attempting next endpoint for pull after error: unauthorized: authentication required"
error msg="Not continuing with pull after error: Error: image fan/couchbase450ee:latest not found"
error msg="Handler for POST /v1.24/containers/create returned error: No such image: fan/couchbase450ee:latest"
error msg="Attempting next endpoint for pull after error: unauthorized: authentication required"
error msg="Not continuing with pull after error: Error: image fan/couchbase450ee:latest not found"
error msg="containerd: notify OOM events" error="cgroup path for memory not found"
error msg="Handler for POST /v1.24/containers/create returned error: No such image: couchbase450ee:4.0"
error msg="Attempting next endpoint for pull after error: unauthorized: authentication required"
error msg="Not continuing with pull after error: Error: image library/couchbase450ee:4.0 not found"
error msg="containerd: notify OOM events" error="cgroup path for memory not found"
error msg="Handler for POST /v1.24/build returned error: Error processing tar file(exit status 1): unexpected EOF"
error msg="containerd: notify OOM events" error="cgroup path for memory not found"
error msg="Attempting next endpoint for pull after error: unauthorized: authentication required"
error msg="Not continuing with pull after error: Error: image fan/couchbase450ee:latest not found"
error msg="pulling image failed" error="Error: image fan/couchbase450ee:latest not found" module=taskmanager task.id=3d4v72m8xqnhl446nc8s3onwu
error msg="containerd: notify OOM events" error="cgroup path for memory not found"
error msg="Attempting next endpoint for pull after error: unauthorized: authentication required"
error msg="Not continuing with pull after error: Error: image fan/couchbase450ee:latest not found"
error msg="pulling image failed" error="Error: image fan/couchbase450ee:latest not found" module=taskmanager task.id=0yx2og72z69tzznqesg5vhvfd
error msg="containerd: notify OOM events" error="cgroup path for memory not found"
error msg="Attempting next endpoint for pull after error: unauthorized: authentication required"
error msg="Not continuing with pull after error: Error: image fan/couchbase450ee:latest not found"
error msg="pulling image failed" error="Error: image fan/couchbase450ee:latest not found" module=taskmanager task.id=7etnrx96xmmcf4iaoahmms9af
error msg="containerd: notify OOM events" error="cgroup path for memory not found"
error msg="container status unavailable" error="context canceled" module=taskmanager task.id=7etnrx96xmmcf4iaoahmms9af
warning msg="cannot find target task in store" method="(*Dispatcher).UpdateTaskStatus" node.id=0obq99m4q993ozljjfguqvq8h node.session=0zbfvgw9tgllcunox0x7h5zw9 task.id=7etnrx96xmmcf4iaoahmms9af
error msg="task unavailable" method="(*Dispatcher).processTaskUpdates" module=dispatcher task.id=7etnrx96xmmcf4iaoahmms9af

Did you find a solution? I have the same problem on 1.12.3. Using Ubuntu images, not Debian though.

In swarm-mode the manager does not share the local images with all the other nodes if the swarm cluster. So when you build your image on a node (let’s call it node-1), only this node have access to the image. And when you execute “docker service create”, you do not know on which node the container(s) corresponding to the service will be started (except if you use constraints), so if this is on a different node, it cannot access to the image you built because this image only exists on node-1.
To achieve this, you must use a registry (either Dockerhub or a private registry) and push your image on it after the build. Then, if you specify the complete name for the image (/<image_name>), the creation of the service will cause the image to be pulled from the registry to the node(s) that must receive the container(s) corresponding to the service.

@yogeek you are right, but if i manually build it on the second node it should therefore check if a local version of it is available? i understand the issue but i dont understand why it does not work that way. i assume that if i create a service it will use some build-id of the image rather than the actual name (tag) of it- this will of course differ at the different nodes and would cause this behavior. but i am not sure if it is the right solution.

@srzjulio unfortunately not, but the solution from yogeek will work of course.

Yes, the image can be shared via private registry. But, I have another question, can the cached image be shared across the host. That is, in the cluster, the images are pulled and cached on one host then shared by other host. Could it be solved by shared storage?