Docker save: No such image - docker

When i run docker save nifi > nifi_backup.tar i get
Error response from daemon: No such image: nifi
When i run docker ps -a i got
$docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a8796cbf6cb1 apache/nifi:1.9.2 "../scripts/start.sh" 11 months ago Exited (0) 33 minutes ago nifi
f4ecf6ca0d16 apache/nifi "../scripts/start.sh" 12 months ago Exited (0) 12 months ago nervous_poincare
9a68c235bb3a apache/nifi "../scripts/start.sh" 12 months ago Exited (0) 12 months ago jolly_mendel
d608287fe560 superset_superset "/entrypoint.sh" 2 years ago Up 27 hours (healthy) 0.0.0.0:8088->8088/tcp, :::8088->8088/tcp superset_superset_1
fcea620b1983 postgres:10 "docker-entrypoint.s…" 2 years ago Up 27 hours 0.0.0.0:5433->5432/tcp, :::5433->5432/tcp superset_postgres_1
380782e0a024 redis:3.2 "docker-entrypoint.s…" 2 years ago Up 27 hours 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp superset_redis_1
Also, i cant start nifi image
if i run docker start nifi
it try to start about a minute, but then stop silently.
And there is no logs in result.
docker events says exit code = 0:
Maybe it has some relation for unavailable saving, so i inform about it too.
How to fix No such image in such a case?

Use the command docker images to see if there is an image named nifi. If not first build that image and than execute the command:
docker save nifi > nifi_backup.tar
It should not show the error No such image: nifi if the command docker images has an image named nifi.

As per documentation here, docker save command expects an image name, not a container. You're probably looking for docker export (export docs) command to achieve what you want.
The error about starting your container could be container-specific. As it exited already a year ago, maybe data is lost and the container cannot be started again. Using command docker events&, you can start the docker event listener in the background. This way you can obtain the hex value of this very start attempt and use it to search specific logs: docker logs <startId hex>. Maybe it can tell you more details about why the container did not properly start.

Related

My docker container with cloudera quickstart image desapears few seconds after I started

I'm trying to execute a docker container with a Cloudera quickstart image in Windows 11.
I followed the tutorial in the page https://hub.docker.com/r/cloudera/quickstart/.
When I execute the image from docker dash I received the error "Error invoking remote method 'docker-run-container': Error: (HTTP code 400) unexpected - No command specified".
There is no log.
My Docker app is updated - Docker Desktop 4.5.1 (74721).
I did the image download from command:
docker pull cloudera/quickstart:latest
REPOSITORY TAG IMAGE ID CREATED SIZE
docker/getting-started latest bd9a9f733898 3 weeks ago 28.8MB
cloudera/quickstart latest 4239cd2958c6 5 years ago 6.34GB
The container is created
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4242480d0804 4239cd2958c6 "/usr/bin/docker-qui…" 5 minutes ago Exited (139) 4 minutes ago charming_buck
6b3e7313b8e9 docker/getting-started "/docker-entrypoint.…" 2 days ago Exited (0) 2 hours ago interesting_ptolemy
I've seen some similar questions with some answers like change the .wslconfig file, I did it but I got same error.
{
"builder": {
"gc": {
"defaultKeepStorage": "8GB",
"enabled": true
}
},
"experimental": false,
"features": {
"buildkit": true
}
}
But with no result. Is there anyone could help me?
Thank you!!
1: to start the container run
docker run --hostname=quickstart.cloudera --privileged=true -it cloudera/quickstart /usr/bin/docker-quickstart
Note 1: /usr/bin/docker-quickstart is provided as a convenience to start all CDH services, then run a Bash shell. You can directly run /bin/bash instead if you wish to start services manually.
Note: 2 A container will die when you exit the shell, but you can disconnect and leave the container running by hitting Ctrl+P -> Ctrl+Q.

Docker fails to start container in detached mode

I have a Google VM that i am trying to start a container, that will start up a web server.
Since i want to be able to do other things with my terminal, i tried starting the container in detached mode.
This is what i typed:
sudo docker run -d -p 5001:5001 -v $(pwd):/mnt/translation -w="/mnt/translation" -e "TERM=xterm-color" f_translate
After this, i get back a string
9f8cc86f1e4a262bff8ff4f40f1a9036c686472b0ec3fded84980a60d26f6980
However, i couldn't connect to the server with docker exec.
I typed docker ps, to see all running containers, but there are none running.
EDIT:
This is the result of the docker ps -a:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9f8cc86f1e4a f_translate "/bin/bash" 28 minutes ago Exited (0) 28 minutes ago reverent_sinouss
i
faeec783edce f_translate "/bin/bash" 37 minutes ago Exited (0) 37 minutes ago adoring_chaum
1b96a5117aef f_translate "/bin/bash" 25 hours ago Exited (129) 24 hours ago xenodochial_noet
her
b364de5733b9 f_translate "/bin/bash" 41 hours ago Created nice_lumiere
5b042e459548 f_translate "/bin/bash" 41 hours ago Exited (0) 41 hours ago hardcore_elbakya
n
ea97b56d6822 f_translate "/bin/bash" 42 hours ago Created practical_lumier
e
2392c2b074a1 f_translate "/bin/bash" 42 hours ago Created hardcore_easley
e24c579f3094 f_translate "/bin/bash" 42 hours ago Created inspiring_merkle
3e4e412c551b f_translate "/bin/bash" 42 hours ago Created crazy_engelbart
8c198931c560 f_translate "/bin/bash" 42 hours ago Exited (0) 41 hours ago hardcore_cannon
67c5ad80b074 f_translate "/bin/bash" 42 hours ago Exited (0) 42 hours ago dreamy_margulis
b2b8773a9d77 a2f276018a81 "/bin/bash" 42 hours ago Exited (127) 42 hours ago jolly_greider
2c3c74ee073c a2f276018a81 "/bin/bash" 42 hours ago Exited (0) 42 hours ago pensive_chandras
ekhar
8563a35a96a7 cq_image "/bin/bash" 47 hours ago Exited (127) 46 hours ago gallant_rubin
44431d47308c cq_image "/bin/bash" 2 days ago Exited (129) 2 days ago peaceful_tesla
When i type docker logs 9f8cc86f1e4a262bff8ff4f40f1a9036c686472b0ec3fded84980a60d26f6980, i get nothing back.
You're run the container only with the bash command. This command returns exit code 0 immediately after the run. Then container finishing the work.
You have to run the container with some process that not returns the exit code right after a run.
This is a normal behavior that container finishing work when the job is finished with the success or with the error.
It seems as if there is a need to explain what containers do:
Containers have been designed to do one job. You tell them which command to execute and they will do that until it is done. Usually this is specified within a Dockerfile, in there you can define ENTRYPOINT and CMD to tell the container what to do when starting up. The container will then do that particular job until its done and then shut down.
And that's the case with your container. Your container executes the command /bin/bash as can be seen in the COMMAND column of the docker ps -a output.
So it actually is doing what it is supposed to do. It simply is executing the bash and since the command finished at that point it is shutting down, therefore you cannot connect to it anymore.
To be able to exec into a container it must be up and running, to do so you will have to change the entrypoint of your container. You can either do so by building a new image via a Dockerfile or you can overwrite it on the fly with the docker run command.
For debugging purposes, especially when wanting to exec into the container manually, you are most likely going to choose a command that does nothing but runs forever, perhaps something like sleep infinity.
TL;DR
With docker run after mentioning the image name you can define which command the container shall execute when starting up.
Execute the following command to ensure that your container does not exit immediately:
sudo docker run -d -p 5001:5001 -v $(pwd):/mnt/translation -w="/mnt/translation" -e "TERM=xterm-color" f_translate /bin/sh -c sleep infinity

Unexpected extra container created when deploying a service to a swarm

I observe an odd behavior of swarm when I create a service with docker in swarm mode.
basically, I create a service from a private registry, with a binding mount :
docker service create --mount type=bind,src=/some/shared/filesystem/mod_tile,dst=/osm/mod_tile,ro --name="mod_tile" --publish 8082:80 --replicas 3 --with-registry-auth my-registry:5050/repo1/mod_tile
This goes well... and my services are replicated the way I expected...
But When I perform a docker ps on the manager, I see my expected container, as well as an unexpected second container, running from the same image, with a different name :
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ca33d my-registry:5050/mod_tile:latest "apachectl -D FOREGRâ¦" About a minute ago Up About a minute vigilant_kare.1.fn5u
619e7 my-registry:5050/mod_tile:latest "apachectl -D FOREGRâ¦" 3 minutes ago Up 3 minutes mod_tile.3.dyismrc
4f1ebf demo/demo-tomcat:0.0.1 "./entrypoint.sh" 7 days ago Up 7 days (healthy) 9900/tcp, 0.0.0.0:8083->8080/tcp tomcatgeoserver
d3adf some.repo:5000/manomarks/visualizer:latest "npm start" 8 days ago Up 8 days 8080/tcp supervision_visualizer.1.ok27kbz
673c1 some.repo:5000/grafana/grafana:latest "/run.sh" 8 days ago Up 8 days 3000/tcp supervision_grafana.1.pgqko8 some.repo:5000/portainer:latest "/portainer --externâ¦" 8 days ago Up 8 days 9000/tcp supervision_portainer.1.vi90w6
bd9b1 some.repo:5000/prom/prometheus:latest "/bin/prometheus -coâ¦" 8 days ago Up 8 days 9090/tcp supervision_prometheus.1.j4gyn02
d8a8b some.repo:5000/cadvisor:0.25.0 "/usr/bin/cadvisor -â¦" 8 days ago Up 8 days 8080/tcp supervision_cadvisor.om7km
bd46d some.repo:5000/prom/node-exporter:latest "/bin/node_exporter â¦" 8 days ago Up 8 days 9100/tcp supervision_nodeexporter.om7kmd
04b53 some.repo:5000/sonatype/nexus3 "sh -c ${SONATYPE_DIâ¦" 9 days ago Up 2 hours 0.0.0.0:5050->5050/tcp, 0.0.0.0:8081->8081/tcp nexus_registry
At first, I thought it was a remaining container from previous attempts, so I stoped it... but a few seconds later, it was up again! No matter how many time I stop it, it will be restarted.
So, I guess it is there on purpose... but I don't understand : I already have my 3 replicas running (I checked on all nodes), and even though I promote another node, the extra container appears only on the leader...
This may come from one of my other containers (used for supervision), but so far, I couldn't figure out from which one...
Does any one have an idea why this extra container is created?
EDIT 05/07
Here are the result of a docker ps on the mod_tile service. The 3 replicas are here, one one each node. The extra service is not considered by the "ps" command.
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
c77gc mod_tile.1 my-registry:5050/mod_tile:latest VM3 Running Running 15 hours ago
u7465 mod_tile.2 my-registry:5050/mod_tile:latest VM4 Running Running 15 hours ago
dyism mod_tile.3 my-registry:5050/mod_tile:latest VM2 Running Running 15 hours ago
It looks like you have a second service defined with the name "vigilant_kare", possibly automatically named if you didn't provide a name.
Swarm mode will automatically correct a down or deleted container to return you to the target state. To delete a container managed by swarm mode, you need to delete the service that manages it:
docker service rm vigilant_kare

Why does the name column of the docker ps -a always different

I was just playing around with docker!!
Ran ps command -a option
docker run -a
C:\Users\sarkan1>docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3d6db385321c busybox:1.24 "sleep 1000" 26 seconds ago Up 24 seconds lucid_ramanujan
e6acd65398b2 hello-world "/hello" 43 minutes ago Exited (0) 43 minutes ago nifty_brattain
c5576137580d hello-world "/hello" 4 days ago Exited (0) 4 days ago dreamy_aryabhata
2594fbf1fa82 hello-world "/hello" 4 days ago Exited (0) 4 days ago nostalgic_hopper
c0102bc64c45 hello-world "/hello" 4 days ago Exited (0) 4 days ago vibrant_khorana
c4af79ea96e9 hello-world "/hello" 4 days ago Exited (0) 4 days ago cranky_heyrovsky
Questions :
Why did I get the values in the names column always different? I ran the same container I guess!!
What is command column? Does the slash before the hello (/hello) have any significance?
Unless you launch a container specifying its name (docker run --name), docker will generate one for you.
That is easier than referencing said container with its ID.
You can then make docker commands with its (generated) name instead.
See more at "How does Docker generate default container names?".
(and the source code: moby/moby pkg/namesgenerator/names-generator.go)
The command column is the full command executed by the container: once this command stops, the container stops.
That command is specified in the docker image, and is a combination of:
Dockerfile ENTRYPOINT
Dockerfile CMD
(See "difference between cmd and entrypoint in dockefile")
Basically they are random container names generated!! The left and right parts of the names are hardcoded and can be found in
https://github.com/moby/moby/blob/master/pkg/namesgenerator/names-generator.go
Docker engine generates it if default name is not provided when you create a new docker container.

deleting old images in Docker - OSX

I've been toying with a docker image for Tensorflow.
To summarize, I first installed the standard image, then realized I needed nodejs, so added it and did a docker commit. Then realized I needed expressJS, added it an did a commit
I am running docker v1.12.5 (so the new gc/prune commands are not there)
At this stage, docker images -a shows:
REPOSITORY TAG IMAGE ID CREATED SIZE
tensor-node-express latest f2f59eb61aae 15 hours ago 2.104 GB
gcr.io/tensorflow/tensorflow latest-devel 308238445d5c 2 days ago 1.995 GB
gcr.io/tensorflow/tensorflow <none> 74435614a991 9 days ago 1.52 GB
I only want to keep tensor-node-express and delete the older images.
$ docker rmi 308238445d5c
Error response from daemon: conflict: unable to delete 308238445d5c (cannot be forced) - image has dependent child images
$docker rmi gcr.io/tensorflow/tensorflow:latest-devel
Error response from daemon: conflict: unable to remove repository reference "gcr.io/tensorflow/tensorflow:latest-devel" (must force) - container 03de9d864e31 is using its referenced image 308238445d5c
I assumed that this means docker commits store differential images, but when I go to ~/.docker/machine/machines/default, I see:
40894464 Mar 13 13:57 boot2docker.iso
5043847168 Mar 16 08:34 disk.vmdk
I suppose the 5G file is a composite of my images, which seems to show each docker commit is the full image!
Any thoughts on how I can only use the latest docker image (tensor-node-express) and free my HD of the invasion of docker?
Supplementary info - here is the output of docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e6dcd2915991 tensor-node-express "/bin/bash" 15 hours ago Exited (130) 15 hours ago flamboyant_bose
fb44b19a21c2 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 18 hours ago Exited (130) 15 hours ago compassionate_bose
075001a687e3 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 18 hours ago Exited (0) 18 hours ago nervous_sinoussi
a80ce2d2e688 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 19 hours ago Exited (130) 18 hours ago happy_euclid
f493bd3c8712 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 19 hours ago Exited (1) 19 hours ago friendly_cori
03de9d864e31 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 2 days ago Exited (255) 23 minutes ago 6006/tcp, 8888/tcp tender_hopper
2dd1e83d62d3 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 2 days ago Exited (0) 15 hours ago modest_einstein
3067ed171b1c gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 2 days ago Exited (0) 2 days ago dazzling_bhabha
62c699afd3fd 74435614a991 "/bin/bash" 2 days ago Exited (127) 2 days ago inspiring_austin
9523ffe2945c 74435614a991 "/bin/bash" 2 days ago Exited (0) 2 days ago kickass_leakey
e06958ea517c 74435614a991 "/bin/bash" 2 days ago Exited (0) 2 days ago objective_euler
ccf922954667 74435614a991 "/bin/bash" 2 days ago Exited (255) 2 days ago dreamy_bartik
fad0d92a07a3 74435614a991 "/bin/bash" 2 days ago Exited (130) 2 days ago elastic_dubinsky
f2a98d4e11ea 74435614a991 "/bin/bash" 2 days ago Exited (0) 2 days ago heuristic_kilby
f07e46367b17 74435614a991 "/bin/bash" 2 days ago Exited (130) 2 days ago trusting_darwin
5bbf9cf992b8 74435614a991 "/bin/bash" 2 days ago Exited (0) 2 days ago flamboyant_knuth
I tried
docker ps --filter "status=exited" | grep "days ago" | awk '{print $1}' | xargs docker rm (credit)
I ran the above manually as well for some of the containers it missed
That pruned the ps list to:
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e6dcd2915991 tensor-node-express "/bin/bash" 15 hours ago Exited (130) 15 hours ago flamboyant_bose
But even then I can't delete old images - same error.
Further update, I tried to list dependencies in images (credit)
using this script:
for i in $(docker images -q)
do
docker history $i | grep -q 74435614a991 && echo $i
done | sort -u
And it told me:
308238445d5c
74435614a991
f2f59eb61aae
This means my new images are child images of the old image. But the size is not a differential looking at the disk size.
Thoughts?
docker-machine uses a Linux VM
When you looked at the docker-machine .vdmk and .iso files, what you are looking at is files for a Linux VM running on your Mac. This is needed because Docker requires Linux kernel features to run, it cannot run directly on the Mac's microkernel.
So your Mac is running a Linux virtual machine, and inside that virutal machine is running the Docker daemon and all of your containers.
Therefore the file size of the .vmdk and .iso tell you nothing about any one image.
docker images have parent/child relationships
As you may already know, docker images have parents and/or children. For instance when you build an image with a Dockerfile like this:
FROM ubuntu:latest
RUN apt-get update && apt-get install nginx
You will end up with a new image that you have perhaps tagged my-nginx. But it requires the ubuntu:latest image as its parent; you cannot delete ubuntu:latest with this image still around, as it requires its parent.
docker commit creates those relationships
When you use docker commit, you are basically doing a dynamic snapshot build. It is similar to the above, except there's no Dockerfile involved.
The above example has a FROM line which indicates the image to use as a base. When using commit, there is a base implied - whatever image was used to launch the running container that you are committing.
The above example has a RUN command which will create new contents in the built image, above and beyond the base image. In a real Dockerfile there are usually multiple commands that do various things which build on the base image. When you use commit, you don't have that. Instead, anything that has been written to the container on top of the base image is your new content. It exists in a read-write filesystem layer in the container. That is the thing you are committing; it is written as a new read-only layer and you get that back as a new (immutable, read-only) docker image. With a parent.
Based on your comments, and the question itself, you appear to have believed that using docker commit would create a new full image that had no dependencies on other images. That is not true. You can craft images like that if you build them yourself from scratch, just not this way.
You can untag the image
If what you want is for the image to not show up in your list, that's easy. Just untag it.
docker rmi gcr.io/tensorflow/tensorflow:latest-devel
However, this is more or less cosmetic. The image will still be there, as another image requires it. All this does is remove the tag, so it doesn't appear in the docker images list anymore without the -a flag.
The reason trying this did not work for you is you tried to rmi the image using its ID, not using its tag.

Resources