Why is docker images list empty? - docker

I'm trying to see a list of images in my docker instance, but I keep getting an empty list.
I run
docker run busybox:latest echo hello
It prints hello. I run
docker images list --all
it prints
REPOSITORY TAG IMAGE ID CREATED SIZE
The same thing happens if I try docker load -i myimage.tar and list. Why isn't it showing any images?
docker version
Client:
Version: 17.06.1-ce
API version: 1.30
Go version: go1.8.3
Git commit: 874a737
Built: Thu Aug 17 22:51:12 2017
OS/Arch: linux/amd64
Server:
Version: 17.06.1-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: 874a737
Built: Thu Aug 17 22:50:04 2017
OS/Arch: linux/amd64
Experimental: false

Try
docker images
I think the docker client is trying to filter by token list and therefore is not finding any images with this name criteria.

docker images - Will list all the images.
docker image ls - is same as "docker images"
docker images ls - here "ls" acts as filter.

Another alternative answer is to enter docker image ls

Related

docker-compose push incorrect image size

I've used docker-compose push for years now with no issues, till today. I'm confused by this one. Basically it looks like it's only pushing the local changes in my Dockerfile, but not the entire image based on my Dockerfile and the original source image.
$ docker-compose build
...
...
Successfully tagged registry.gitlab.com/<path_obfuscated>:21.10.02
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
...
registry.gitlab.com/<obfuscated-path---------------------------> 21.10.02 3c8d770f0649 23 minutes ago 1.2GB
...
So you can see the image is 1.2 GB.
Now I run: docker-compose push
It happens superfast, and when I look at the image on my registry, it's only 388 MB, instead of the expected 1.2 GB.
Does someone know why this is happening? I've been using the same method for years now, and this is the first that I ran into this issue.
Some extra bits:
$ docker version
Client:
Version: 20.10.8
API version: 1.41
Go version: go1.16.6
Git commit: 3967b7d28e
Built: Wed Aug 4 21:24:10 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.8
API version: 1.41 (minimum version 1.12)
Go version: go1.16.6
Git commit: 75249d8
Built: Wed Aug 4 21:26:30 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.4.9
GitCommit: e25210fe30a0a703442421b0f60afac609f950a3
runc:
Version: 1.0.1
GitCommit:
docker-init:
Version: 0.19.0
GitCommit: de40ad0
$ docker-compose --version
docker-compose version 1.25.5, build unknown
According to this issue in Docker GitHub:
docker images shows the uncompressed size. During a docker push, the engine compresses (gzip) the image before sending to the registry. The size shown in the Hub UI is the compressed size, and roughly represents how much work a fresh docker pull would need to do. The network transfer size is probably the more important number when deploying containers.

Why docker container update is not stable?

I use the command docker container update --cpus 1 target_container to update the setting. But in most cases it not working and response "you must provide one or more flags when using this command", but somethings it working
Any one know the reason?
Some log is like,
$ docker container update --cpus 0.5 target_container
you must provide one or more flags when using this command
$ docker container update --cpus 0.5 target_container
you must provide one or more flags when using this command
$ docker container update --cpus 0.5 target_container
target_container
the docker version is
Client:
Version: 18.09.7
API version: 1.39
Go version: go1.10.4
Git commit: 2d0083d
Built: Fri Aug 16 14:19:38 2019
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.09.7
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 2d0083d
Built: Thu Aug 15 15:12:41 2019
OS/Arch: linux/amd64
Experimental: false
The docker update man page includes:
--cpus API 1.29+
A docker version can show you if your API is equal or above the API 29, which was with Docker 17.05.
For testing, try --cpus=1 or --cpus=0.5, considering the argument is supposed to be "number of CPUs"
As usual with commands including an hyphen: don't copy-paste it, copy it manually.

docker run command hangs until the container stops

I am trying to run a PPTP VPN server in a Docker container. but when I do the command docker run pptpserver, or all different container I have tried, It will work but my cursor is just flashing and does not let me do any other command.
I tried a super simple one, just copying test.sh in the container and run it, and it prints a confined times test, but I want a container that's in the background.
test.sh:
#/bin/bash
while :; do
echo "test"
sleep 2
done
The only way I can stop it is to stop the container in another terminal. Is there something I can do to just run a container like it shouts do, in the background.
# docker version
Client:
Version: 17.12.1-ce
API version: 1.35
Go version: go1.10.1
Git commit: 7390fc6
Built: Wed Apr 18 01:23:11 2018
OS/Arch: linux/amd64
Server:
Engine:
Version: 17.12.1-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.10.1
Git commit: 7390fc6
Built: Wed Feb 28 17:46:05 2018
OS/Arch: linux/amd64
Experimental: false
To prevent this, you should start a container in detached mode by specifying -d=true or just -d option. If this is not specified, docker defaults to foreground mode which attaches the console to the process inside your container's standard input, output and standard error, which makes it appear as if your terminal is "hanging".
So try:
docker run -d pptpserver
You can read more about this behaviour in the Docker Run Reference documentation.

Modifying Docker Images Directly

i'm new to docker. I run docker "natively" from a Windows server 2016 with a Windows container, there is no intermediate VM (no docker machine) in between and no docker toolbox, so the "host" is the actual Windows Server that I run docker on.
Docker version:
PS C:> docker version
Client:
Version: 17.03.1-ee-3
API version: 1.27
Go version: go1.7.5
Git commit: 3fcee33
Built: Thu Mar 30 19:31:22 2017
OS/Arch: windows/amd64
Server:
Version: 17.03.1-ee-3
API version: 1.27 (minimum version 1.24)
Go version: go1.7.5
Git commit: 3fcee33
Built: Thu Mar 30 19:31:22 2017
OS/Arch: windows/amd64
Experimental: false
PS C:\>
i pulled the image from docker hub. I need to replace the files inside the docker image while running and commit changes to the image.
Lets say i have Sample.java and datafile.properties inside the docker image which i pulled from docker hub.
i want to replace that with Hello.java and data.properties[ i pulled these files from github]
how would i do that in an automated way? Any advise and some examples on this would he helpful. Thanks in advance.

docker golang API ContainerList fails with TLS

I have dockerd configured with TLS authentication on CoreOS;
Cli docker images returns me valid list of images:
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest c75bebcdd211 3 weeks ago 1.106 MB
But trying it in "go" code:
export DOCKER_CERT_PATH=~/.docker
images, err := cli.ImageList(context.Background(), types.ImageListOptions{})
returns me empty list
Below is my docker configuration:
Client:
Version: 1.12.6
API version: 1.24
Go version: go1.6.3
Git commit: d5236f0
Built: Tue May 30 23:15:08 2017
OS/Arch: linux/amd64
Server:
Version: 1.12.6
API version: 1.24
Go version: go1.6.3
Git commit: d5236f0
Built: Tue May 30 23:15:08 2017
OS/Arch: linux/amd64
You have a list of images but you haven't created any containers yet, therefore cli.ContainerList() returns empty list
What you are probably looking for is cli.ImageList()
Docs:
https://godoc.org/github.com/docker/engine-api/client#Client.ImageList

Resources