Localhost Registry in Kubernetes - distribute certificates - docker

I am running Docker for Mac(Edge) and I have a Kubernetes Cluster.
I am trying to be able to run a Registry inside Kubernetes, so I can push images to the cluster and use them in a Localhost environment.
I have installed a Registry with Helm: helm install stable/docker-registry
And I am able to run with portforward:
export POD_NAME=$(kubectl get pods --namespace default -l "app=docker-registry,release=guiding-hedgehog" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:5000
The problem is that I get an error when trying to push to the registry with docker push localhost:5000/hello:
The push refers to repository [localhost:5000/hello]
Get http://localhost:5000/v2/: dial tcp [::1]:5000: getsockopt: connection refused
kubectl get services:
NAME: eyewitness-moose-docker-registry TYPE: ClusterIP CLUSTER-IP:10.106.213.130 EXTERNAL-IP:<none> PORT(S):5000/TCP
Note: Also tried adding docker.for.mac.localhost:5000 to list of insecure registries.
So it looks like a security issue, and might be related to that it is not possible to run an insecure registry described in Docker doc
Therefore I have created a certificate as described here.
Now the question is, how do I distribute the certificate to each node with only kubectl?
Note: I am running in Docker for Mac(Edge), so I can get to the Kubernetes running containers. But there is so many and how and I don't think that is is the right way:
7d50a16271b5 gcr.io/kubernetes-helm/tiller "/tiller" 19 hours ago Up 19 hours k8s_tiller_tiller-deploy-865dd6c794-j7nk8_kube-system_8cbf6a09-329d-11e8-83ed-025000000001_0
6c77c450b374 gcr.io/google_containers/pause-amd64:3.0 "/pause" 19 hours ago Up 19 hours k8s_POD_tiller-deploy-865dd6c794-j7nk8_kube-system_8cbf6a09-329d-11e8-83ed-025000000001_0
ff19b2587142 docker/kube-compose-controller "/compose-controller…" 40 hours ago Up 40 hours k8s_compose_compose-5d4f4d67b6-n9jbp_docker_d7fc0ef4-3065-11e8-b9f8-025000000001_0
22109b6207af docker/kube-compose-api-server "/api-server --kubec…" 40 hours ago Up 40 hours k8s_compose_compose-api-7bb7b5968f-9mjxr_docker_d7f23906-3065-11e8-b9f8-025000000001_0
fd35236592f2 gcr.io/google_containers/k8s-dns-sidecar-amd64 "/sidecar --v=2 --lo…" 40 hours ago Up 40 hours k8s_sidecar_kube-dns-6f4fd4bdf-h25hz_kube-system_ba973aaa-3065-11e8-b9f8-025000000001_0
8df955fd61f4 gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64 "/dnsmasq-nanny -v=2…" 40 hours ago Up 40 hours k8s_dnsmasq_kube-dns-6f4fd4bdf-h25hz_kube-system_ba973aaa-3065-11e8-b9f8-025000000001_0
2b35fb82f6e6 gcr.io/google_containers/k8s-dns-kube-dns-amd64 "/kube-dns --domain=…" 40 hours ago Up 40 hours k8s_kubedns_kube-dns-6f4fd4bdf-h25hz_kube-system_ba973aaa-3065-11e8-b9f8-025000000001_0
89b4e3ccccd5 gcr.io/google_containers/pause-amd64:3.0 "/pause" 40 hours ago Up 40 hours k8s_POD_compose-5d4f4d67b6-n9jbp_docker_d7fc0ef4-3065-11e8-b9f8-025000000001_0
d5a6a2ba714b gcr.io/google_containers/pause-amd64:3.0 "/pause" 40 hours ago Up 40 hours k8s_POD_kube-dns-6f4fd4bdf-h25hz_kube-system_ba973aaa-3065-11e8-b9f8-025000000001_0
608c82a39845 gcr.io/google_containers/pause-amd64:3.0 "/pause" 40 hours ago Up 40 hours k8s_POD_compose-api-7bb7b5968f-9mjxr_docker_d7f23906-3065-11e8-b9f8-025000000001_0
38982ea53b7d gcr.io/google_containers/kube-proxy-amd64 "/usr/local/bin/kube…" 40 hours ago Up 40 hours k8s_kube-proxy_kube-proxy-75vvn_kube-system_bace7415-3065-11e8-b9f8-025000000001_0
1e5b99acf1ca gcr.io/google_containers/pause-amd64:3.0 "/pause" 40 hours ago Up 40 hours k8s_POD_kube-proxy-75vvn_kube-system_bace7415-3065-11e8-b9f8-025000000001_0
e75f4b1db79e gcr.io/google_containers/kube-scheduler-amd64 "kube-scheduler --ku…" 40 hours ago Up 40 hours k8s_kube-scheduler_kube-scheduler-docker-for-desktop_kube-system_f851ca949bc3883a8c73ea5debfa5def_0
2834798acbc5 gcr.io/google_containers/kube-apiserver-amd64 "kube-apiserver --ad…" 40 hours ago Up 40 hours k8s_kube-apiserver_kube-apiserver-docker-for-desktop_kube-system_caae2ec94c5b9fe55a01978c5b2f561e_0
91cb9c57c7f6 gcr.io/google_containers/etcd-amd64 "etcd --listen-clien…" 40 hours ago Up 40 hours k8s_etcd_etcd-docker-for-desktop_kube-system_7278f85057e8bf5cb81c9f96d3b25320_0
ead556edb234 gcr.io/google_containers/kube-controller-manager-amd64 "kube-controller-man…" 40 hours ago Up 40 hours k8s_kube-controller-manager_kube-controller-manager-docker-for-desktop_kube-system_81fd91d1cb0957bc579d5dd888f73ead_0
bd4e94136fe5 gcr.io/google_containers/pause-amd64:3.0 "/pause" 40 hours ago Up 40 hours k8s_POD_kube-scheduler-docker-for-desktop_kube-system_f851ca949bc3883a8c73ea5debfa5def_0
45f2657c47a7 gcr.io/google_containers/pause-amd64:3.0 "/pause" 40 hours ago Up 40 hours k8s_POD_kube-controller-manager-docker-for-desktop_kube-system_81fd91d1cb0957bc579d5dd888f73ead_0
3e5a8064e983 gcr.io/google_containers/pause-amd64:3.0 "/pause" 40 hours ago Up 40 hours k8s_POD_etcd-docker-for-desktop_kube-system_7278f85057e8bf5cb81c9f96d3b25320_0
b7ae16f4ce6b gcr.io/google_containers/pause-amd64:3.0 "/pause" 40 hours ago Up 40 hours k8s_POD_kube-apiserver-docker-for-desktop_kube-system_caae2ec94c5b9fe55a01978c5b2f561e_0
Anything in the right direction is welcome.
Thanks in advance

Related

Can't access docker from public IP

So I try running some docker application on My local network it works fine without any problem.
But when I try access it from public IP address it doesn't allow Me to connect
Ex: http://SomePublicIp then browser return with
SSH-2.0-OpenSSH_8.4p1 Debian-5+deb11u1
but when I try with local IP it works normally
the return of docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
yacht
352d4a07c5aa ghcr.io/ajnart/homarr:latest "docker-entrypoint.s…" 13 hours ago Up 13 hours 0.0.0.0:7575->7575/tcp, :::7575->7575/tcp
Homepage
8ba96af5b79b linuxserver/sickgear:latest "/init" 13 hours ago Up 13 hours 0.0.0.0:8081->8081/tcp, :::8081->8081/tcp
sickgear
cb50149d8921 n8nio/n8n:latest "tini -- /docker-ent…" 13 hours ago Up 13 hours 0.0.0.0:5678->5678/tcp, :::5678->5678/tcp
n8n
86d99e6877cc portainer/portainer-ce:latest "/portainer" 14 hours ago Up 13 hours 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp, 9000/tcp
portainer
4bc1c1c244a1 linuxserver/homeassistant:latest "/init" 2 days ago Up 14 hours
HomeAssistant
b712b08105c7 grafana/grafana:8.4.5 "/run.sh" 4 days ago Up 14 hours 0.0.0.0:41117->3000/tcp, :::41117->3000/tcp
Smokeping
8b98f0161300 linuxserver/syncthing:latest "/init" 4 days ago Up 14 hours 0.0.0.0:8384->8384/tcp, 0.0.0.0:21027->21027/udp, :::8384->8384/tcp, :::21027->21027/udp, 0.0.0.0:22000->22000/tcp, :::22000->22000/tcp, 0.0.0.0:22000->22000/udp, :::22000->22000/udp
Syncthing
a0622f05ac9f nodered/node-red:2.2.2-12 "npm --no-update-not…" 10 days ago Up 14 hours (healthy) 0.0.0.0:1880->1880/tcp, :::1880->1880/tcp

Copy a file from local machine to docker container

I am following this example:
I find the namenode as follows:
(dash_apps_36) idf#ubvm:~/Documents/docker-hadoop$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2ce71013488f bde2020/hadoop-resourcemanager:2.0.0-hadoop3.2.1-java8 "/entrypoint.sh /run\u2026" 17 minutes ago Up 17 minutes (healthy) 8088/tcp resourcemanager
7fc72b887e23 bde2020/hadoop-namenode:2.0.0-hadoop3.2.1-java8 "/entrypoint.sh /run\u2026" 17 minutes ago Up 17 minutes (healthy) 0.0.0.0:9000->9000/tcp, 0.0.0.0:9870->9870/tcp namenode
9c3f8c435b87 bde2020/hadoop-nodemanager:2.0.0-hadoop3.2.1-java8 "/entrypoint.sh /run\u2026" 17 minutes ago Up 17 minutes (healthy) 8042/tcp nodemanager
4d57c5bf2f9e bde2020/hadoop-datanode:2.0.0-hadoop3.2.1-java8 "/entrypoint.sh /run\u2026" 17 minutes ago Up 17 minutes (healthy) 9864/tcp datanode
c7eef33905e8 bde2020/hadoop-historyserver:2.0.0-hadoop3.2.1-java8 "/entrypoint.sh /run\u2026" 17 minutes ago Up 17 minutes (healthy) 8188/tcp historyserver
2b1144867924 redis "docker-entrypoint.s\u2026" 6 days ago Exited (137) 6 days ago serene_keldysh
9d9463166b63 redis "docker-entrypoint.s\u2026" 6 days ago Created eloquent_merkle
47d6488e29bf redis:alpine "docker-entrypoint.s\u2026" 4 weeks ago Exited (137) 4 weeks ago wikipedia-playground_redis_1
be5ea0df0401 mcr.microsoft.com/mssql/server:2019-latest "/opt/mssql/bin/perm\u2026" 18 months ago Exited (255) 18 months ago 0.0.0.0:1433->1433/tcp mssql
Using 7fc72b887e23 as the ID of the namenode, when I get to the command
$ docker cp ../hadoop-mapreduce-examples-2.7.1-sources.jar cb0c13085cd3:hadoop-mapreduce-examples-2.7.1-sources.jar
I get an error:
$: command not found
Not sure what I am doing wrong.
Remove the $ at the beginning. That's what $: command not found means. Easy to miss when copy pasting code
docker cp ../hadoop-mapreduce-examples-2.7.1-sources.jar cb0c13085cd3:hadoop-mapreduce-examples-2.7.1-sources.jar

Docker info shows containers but docker container ls doesn't

When I run docker info, it shows that I have 18 containers running.
% docker info
Client:
Debug Mode: false
Server:
Containers: 18
Running: 18
Paused: 0
Stopped: 0
Images: 9
...
I want to delete these containers, but when I run docker container ls -a, it shows an empty list. How can I find them?
These containers are not allowing me to delete images.
% docker rmi -f 1e94481e8f30
Error response from daemon: conflict: unable to delete 1e94481e8f30 (cannot be forced) - image is being used by running container 7e9b08a0007b
You are probably running kubernetes.
After stopping kubernetes, to remove all stopped containers and all images without at least one container associated to them:
docker system prune --all
To stop all running containers
docker stop $(docker ps -a -q)
To remove all containers
docker rm $(docker ps -a -q)
You should be able to delete all images after that
Those 18 containers belong to Kubernetes. You can check this by going to the Preferences > Kubernetes > Check Show system containers (advanced).
After that, just run docker container ls -a again and you will see those 18 containers.
These are the containers you are not seeing unless you check that option:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6c3c65d4bcf4 a8c3d87a58e7 "/compose-controller…" 3 minutes ago Up 3 minutes k8s_compose_compose-6c67d745f6-sr4zj_docker_34e7ef25-166e-11ea-857d-025000000001_2
663d6419ce76 eb516548c180 "/coredns -conf /etc…" 3 minutes ago Up 3 minutes k8s_coredns_coredns-6dcc67dcbc-2twts_kube-system_0c8d1f5f-166e-11ea-857d-025000000001_2
d04a4caf922d eb516548c180 "/coredns -conf /etc…" 3 minutes ago Up 3 minutes k8s_coredns_coredns-6dcc67dcbc-chk2l_kube-system_0c8df4b4-166e-11ea-857d-025000000001_2
324d5d216b07 f3591b2cb223 "/api-server --kubec…" 3 minutes ago Up 3 minutes k8s_compose_compose-api-57ff65b8c7-svv9t_docker_34e161f1-166e-11ea-857d-025000000001_2
f9f74acd5ab6 849af609e0c6 "/usr/local/bin/kube…" 3 minutes ago Up 3 minutes k8s_kube-proxy_kube-proxy-w4x7l_kube-system_0c95526c-166e-11ea-857d-025000000001_2
3cbfa75f1466 k8s.gcr.io/pause:3.1 "/pause" 3 minutes ago Up 3 minutes k8s_POD_compose-6c67d745f6-sr4zj_docker_34e7ef25-166e-11ea-857d-025000000001_2
f11f1cc4bbba k8s.gcr.io/pause:3.1 "/pause" 3 minutes ago Up 3 minutes k8s_POD_coredns-6dcc67dcbc-chk2l_kube-system_0c8df4b4-166e-11ea-857d-025000000001_2
cbb52fdaf130 k8s.gcr.io/pause:3.1 "/pause" 3 minutes ago Up 3 minutes k8s_POD_coredns-6dcc67dcbc-2twts_kube-system_0c8d1f5f-166e-11ea-857d-025000000001_2
5ad88766f27d k8s.gcr.io/pause:3.1 "/pause" 3 minutes ago Up 3 minutes k8s_POD_compose-api-57ff65b8c7-svv9t_docker_34e161f1-166e-11ea-857d-025000000001_2
9f326ea7db5d k8s.gcr.io/pause:3.1 "/pause" 3 minutes ago Up 3 minutes k8s_POD_kube-proxy-w4x7l_kube-system_0c95526c-166e-11ea-857d-025000000001_2
ea36a7a0d248 f1e3e5f9f93e "kube-scheduler --bi…" 3 minutes ago Up 3 minutes k8s_kube-scheduler_kube-scheduler-docker-desktop_kube-system_ef4d089e81b94aa15841e51ed8c41712_2
f3dfa711ea0f 1e94481e8f30 "kube-apiserver --ad…" 3 minutes ago Up 3 minutes k8s_kube-apiserver_kube-apiserver-docker-desktop_kube-system_b1dff398070b11d23d8d2653b78d430e_2
1e5cf76eaf20 2c4adeb21b4f "etcd --advertise-cl…" 3 minutes ago Up 3 minutes k8s_etcd_etcd-docker-desktop_kube-system_3773efb8e009876ddfa2c10173dba95e_2
d631fca0d4ac k8s.gcr.io/pause:3.1 "/pause" 3 minutes ago Up 3 minutes k8s_POD_kube-scheduler-docker-desktop_kube-system_ef4d089e81b94aa15841e51ed8c41712_2
20242b387b05 36a8001a79fd "kube-controller-man…" 3 minutes ago Up 3 minutes k8s_kube-controller-manager_kube-controller-manager-docker-desktop_kube-system_86e291a2049db314a5eca69a05cf6ced_2
b32c2d63090f k8s.gcr.io/pause:3.1 "/pause" 3 minutes ago Up 3 minutes k8s_POD_kube-apiserver-docker-desktop_kube-system_b1dff398070b11d23d8d2653b78d430e_2
4d6e49f60ead k8s.gcr.io/pause:3.1 "/pause" 3 minutes ago Up 3 minutes k8s_POD_etcd-docker-desktop_kube-system_3773efb8e009876ddfa2c10173dba95e_2
9035ccdcae5d k8s.gcr.io/pause:3.1 "/pause" 3 minutes ago Up 3 minutes k8s_POD_kube-controller-manager-docker-desktop_kube-system_86e291a2049db314a5eca69a05cf6ced_2

How do I properly shut down these k8 containers?

I was doing some self-learning with Kubernetes and I have these containers that will not permanently shut down:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8e08ecdf12c2 fadcc5d2b066 "/usr/local/bin/kube…" About a minute ago Up About a minute k8s_kube-proxy_kube-proxy-mtksn_kube-system_08f1149a-4ac6-11e9-bea5-080027db2e61_0
744282ae4605 40a817357014 "kube-controller-man…" About a minute ago Up About a minute k8s_kube-controller-manager_kube-controller-manager-minikube_kube-system_17eea6fd9342634d7d40a04d577641fd_0
0473a3e3fedb f59dcacceff4 "/coredns -conf /etc…" About a minute ago Up About a minute k8s_coredns_coredns-86c58d9df4-l6mdf_kube-system_08f82a2f-4ac6-11e9-bea5-080027db2e61_0
6e9a0a03dff1 4689081edb10 "/storage-provisioner" About a minute ago Up About a minute k8s_storage-provisioner_storage-provisioner_kube-system_0a7e1c9d-4ac6-11e9-bea5-080027db2e61_0
4bb4356e57e7 dd862b749309 "kube-scheduler --ad…" About a minute ago Up About a minute k8s_kube-scheduler_kube-scheduler-minikube_kube-system_4b52d75cab61380f07c0c5a69fb371d4_0
973e42e849c8 f59dcacceff4 "/coredns -conf /etc…" About a minute ago Up About a minute k8s_coredns_coredns-86c58d9df4-l6hqj_kube-system_08fd4db1-4ac6-11e9-bea5-080027db2e61_1
338b58983301 9c16409588eb "/opt/kube-addons.sh" About a minute ago Up About a minute k8s_kube-addon-manager_kube-addon-manager-minikube_kube-system_5c72fb06dcdda608211b70d63c0ca488_4
3600083cbb01 k8s.gcr.io/pause:3.1 "/pause" About a minute ago Up About a minute k8s_POD_kube-addon-manager-minikube_kube-system_5c72fb06dcdda608211b70d63c0ca488_3
97dffefb7a4b ldco2016/multi-client "nginx -g 'daemon of…" About a minute ago Up About a minute k8s_client_client-deployment-6d89489556-mgznt_default_1f1f77f2-4c5d-11e9-bea5-080027db2e61_1
55224d847c72 k8s.gcr.io/pause:3.1 "/pause" About a minute ago Up About a minute k8s_POD_kube-proxy-mtksn_kube-system_08f1149a-4ac6-11e9-bea5-080027db2e61_3
9a66d39da906 3cab8e1b9802 "etcd --advertise-cl…" About a minute ago Up About a minute k8s_etcd_etcd-minikube_kube-system_8490cea1bf6294c73e0c454f26bdf714_6
e75a57524b41 k8s.gcr.io/pause:3.1 "/pause" About a minute ago Up About a minute k8s_POD_etcd-minikube_kube-system_8490cea1bf6294c73e0c454f26bdf714_5
5a1c02eeea6a fc3801f0fc54 "kube-apiserver --au…" About a minute ago Up About a minute k8s_kube-apiserver_kube-apiserver-minikube_kube-system_d1fc269f154a136c6c9cb809b65b6899_3
2320ac2ab58d k8s.gcr.io/pause:3.1 "/pause" About a minute ago Up About a minute k8s_POD_kube-apiserver-minikube_kube-system_d1fc269f154a136c6c9cb809b65b6899_3
0195bb0f048c k8s.gcr.io/pause:3.1 "/pause" About a minute ago Up About a minute k8s_POD_kube-scheduler-minikube_kube-system_4b52d75cab61380f07c0c5a69fb371d4_3
0664e62bf425 k8s.gcr.io/pause:3.1 "/pause" About a minute ago Up About a minute k8s_POD_coredns-86c58d9df4-l6mdf_kube-system_08f82a2f-4ac6-11e9-bea5-080027db2e61_4
546c4195391e k8s.gcr.io/pause:3.1 "/pause" About a minute ago Up About a minute k8s_POD_kube-controller-manager-minikube_kube-system_17eea6fd9342634d7d40a04d577641fd_4
9211bc0ce3f8 k8s.gcr.io/pause:3.1 "/pause" About a minute ago Up About a minute k8s_POD_client-deployment-6d89489556-mgznt_default_1f1f77f2-4c5d-11e9-bea5-080027db2e61_3
c22e7c931f46 k8s.gcr.io/pause:3.1 "/pause" About a minute ago Up About a minute k8s_POD_coredns-86c58d9df4-l6hqj_kube-system_08fd4db1-4ac6-11e9-bea5-080027db2e61_3
e5b9a76b8d68 k8s.gcr.io/pause:3.1 "/pause" About a minute ago Up About a minute k8s_POD_storage-provisioner_kube-system_0a7e1c9d
What is the most efficient way to shut them all down in one go and stop them from restarting?
I ran a minikube stop and that took care of it, but I am unclear as to whether that was the proper way to do it.
This looks like the output of docker ps. When using Kubernetes, you should generally not worry about things at the Docker level, and what containers Docker is running. Some of the containers that are running are part of the Kubernetes API itself, so you should only shut these down if you plan to shut down Kubernetes itself. If you plan to shut down Kubernetes itself, the right way to shut it down depends on how you started it (minkube, GKE, etc?). If you don't plan on shutting down Kubernetes itself, but want to shut down any extra containers that Kubernetes is running on your behalf (as opposed to containers that are running as part of the Kubernetes system itself) you could run kubectl get pods --all-namespaces to see all "user-land" pods that are running. "Pod" is the level of abstraction that you primarily interact with when using Kubernetes, and the specific Docker processes that are running is not something you should need to worry about.
EDIT: I see you updated your question to say that you ran minikube stop. Yes, that is the correct way to do it, nice!

Attach to container

I was surprised when command sudo docker ps -a thrown list of containers:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
efd4879e92e0 ubuntu "/bin/bash" About an hour ago Exited (0) 20 minutes ago elated_newton
7db432be894c ubuntu "/bin/bash" About an hour ago Exited (0) 18 minutes ago nervous_meninsky
aef01293fdc9 ubuntu "/bin/bash" About an hour ago Up About an hour priceless_ramanujan
87cfd461b465 ubuntu "/bin/bash" About an hour ago Up About an hour festive_bhabha
1dcb6f9618d8 ubuntu "/bin/bash" About an hour ago Up About an hour mystifying_poitras
0f1636eb9cc1 hello-world "/hello" About an hour ago Exited (0) About an hour ago sharp_murdock
2a3a1fb03ada hello-world "/hello" About an hour ago Exited (0) About an hour ago admiring_brattain
77c8e7ef5770 hello-world "/hello" 16 hours ago Exited (0) 16 hours ago unruffled_shannon
808805085c59 centos "6.9" 17 hours ago Created youthful_aryabhata
a1438a7811c2 centos "/bin/bash" 17 hours ago Exited (0) 17 hours ago sleepy_neumann
fce6a95f8f5a ubuntu "/bin/bash" 17 hours ago Exited (0) 17 hours ago cranky_ritchie
e17b5f98bbc5 ubuntu "/bin/bash" 17 hours ago Exited (0) 17 hours ago unruffled_ritchie
cafbbe52dad5 hello-world "/hello" 17 hours ago Exited (0) 17 hours ago hungry_pike
d40ac9c16e9c ubuntu "/bin/bash" 17 hours ago Exited (0) 17 hours ago brave_babbage
5efd22250d0e ubuntu "/bin/bash" 17 hours ago Exited (0) 17 hours ago confident_lalande
471e22652bc3 ubuntu "/bin/bash" 17 hours ago Exited (0) 17 hours ago vigorous_wing
b68f43ebae50 ubuntu "bash" 17 hours ago Exited (127) 17 hours ago confident_euler
a83eae486f76 ubuntu "bash" 17 hours ago Exited (0) 17 hours ago infallible_murdock
88b3b4e73e5e hello-world "/hello" 17 hours ago Exited (0) 17 hours ago thirsty_bhabha
deb88e38d347 hello-world "/hello" 17 hours ago Exited (0) 17 hours ago nervous_ptolemy
I was surprised twice when found that some of them alive. Since festive_bhabha is up I would like attach to it:
sudo docker attach festive_bhabha
But command prints nothing and not returns. Why I can't attach to container?
Docker containers are not automatically removed when they exist. You can clean dangling images, exited containers... using:
docker system prune
The Docker container festive_bhabha seems to be an ubuntu image that might not be generating and output, which explains why no output is shown when running the attach command.
You can check what processes are running inside this container by running:
docker container top festive_bhabha
Alternatively, you can exec inside the container.
docker exec -it festive_bhabha bash

Resources