How do I get my docker container onto hub.docker.com? - dockerhub

I am following this tutorial Getting Started with Docker for the Node.js Developer and everything was working smoothly until I got to the end of tutorial where one is to execute these commands ...
$ docker tag node-express your_docker_hub_username/node-express
$ docker rmi node-express
$ docker push your_docker_hub_username/node-express
So for my system I did this ...
$ sudo docker ps -a | grep centos
1c912e61636d node-express-centos:latest "/bin/bash" 31 minutes ago Exited (130) 28 minutes ago gloomy_mestorf
$ sudo docker tag node-express-centos redcricket/node-express-centos
FATA[0000] Error response from daemon: could not find image: no such id: node-express-centos
$ sudo docker tag node-express-centos:latest redcricket/node-express-centos
FATA[0000] Error response from daemon: could not find image: no such id: node-express-centos:latest
... and as you can see I am getting these FATA errors. What am I doing wrong here?

When running your container, you need to name it in order to be able to reference it by name. If not, you will have to reference it using the container ID.
To name your container you can do
$ docker run - - name node-express-centos node-express-centos:latest
You can then tag using same command you used above.

Related

docker, container is not running

docker ps shows instances, but when I try to log in to the instance, it says it's not running?
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
eaa62ff2df11 monitor_kibana "/usr/local/bin/dumb…" 4 months ago Up 9 days kibana
613dc901f2e1 monitor_elasticsearch-search "/usr/local/bin/dock…" 4 months ago Up 9 days elasticsearch-search
$ docker exec -it eaa62 bash
Error response from daemon: Container eaa62ff2df11547744c5f7cf82cad16bf576820d2a209c4f19f173cca68f5511 is not running
$
Could it be that the container only runs for a very short time? If you use the -a flag in your statement to get only active containers, like so:
docker ps -a
Does it still show up? It could be that it runs and just uses something like ECHO. In that case, because the program run succesfully the container is immediately terminated.
Is this an official image? If so, try to run the container without the -d (for deamon) flag. This should output the run information to terminal and give you some information on what is going on.
sudo docker exec -it eaa62 bash

Can't get my Docker Container to start and give me a shell

I am trying to get a Docker Container running. I am following this guide: http://opendata.cern.ch/docs/cms-guide-docker.
The container refuses to start and give me access to the shall I expect.
Running the following command (as mentioned in the guide) does nothing, the process exits with a non-0 exit code. The first time I ran it, it downloaded the container image but did not land me into the sell as the guide says it would.
$ docker run --name opendata-2010 -it cmsopendata/cmssw_4_2_8 /bin/bash
I can see the container, it exits soon as it starts.
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
be670158d200 cmsopendata/cmssw_5_3_32 "/opt/cms/entrypoint…" 34 minutes ago Exited (139) 3 seconds ago opendata
These are other things I have tried to no avail.
$ docker exec -it be670158d200 /bin/bash
Error response from daemon: Container be670158d200ae85871fbda810fa6074dcb7bc8fc606f000710f630add1b80b6 is not running
$ docker start --attach be670158d200
failed to resize tty, using default size
My question is similar to this: Docker - Container is not running, but I know that unlike in that question, here I should be getting the shell.
I am running this in Windows Subsystem for Linux 2 - Ubuntu 20.04, docker version 19.03.8 - build afacb8b7f0. Any help is greatly appreciated, thanks.
I had the same error with below logs
dockerd[15309]: time="2022-01-11T11:13:35.133154132+05:30" level=error msg="Handler for POST /v1.41/exec/94553dc2f9aaa3c1245df7384138786a8a576af99105a285258fce8b980b4660/resize returned error: timeout waiting for exec session ready"
This is a bug in docker 20.10 version and can be solved by downgrading containerd rpm
Removed:
containerd.io.x86_64 0:1.4.4-3.1.el7
Installed:
containerd.io.x86_64 0:1.4.3-3.1.el7

how to run docker image with iptables support enabled?

I have these two containers:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0d671dfac62b ubuntu "/bin/bash" 38 minutes ago Exited (0) 11 minutes ago firewall-test
c17081905d25 ubuntu "bash" 2 hours ago Exited (0) 2 hours ago mystifying_kalam
I would like to start the firewall-test container with a bash shell and this setting --cap-add=NET_ADMIN
The command i am trying does not work, it keep complaining about the latest version of this container...
sudo docker run --cap-add=NET_ADMIN -it firewall-test bash
Unable to find image 'firewall-test:latest' locally
docker: Error response from daemon: pull access denied for firewall-test, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
The firewall-test container is based on the ubuntu one under it in the list.
How can i run this container with net-admin support so i can play around with iptables?
Thanks
You are having trouble with the syntax here. The form is 'docker run [-OPTIONS] [IMAGE NAME] {commands if you use options like -it or an entrypoint}'.
In your case it would be "docker run --cap-add=NET_ADMIN -it [IMAGE NAME] bash". First be sure that you have a 'firewall-test' image already build/downloaded.
In case you're using a Dockerfile image based, first build it. Or if you are using an image from hub.docker on something like that be sure the name is correct.
Good luck

how to stop unknown running docker containers

I have docker installed on my mac and when I do docker info I see this information:
Containers: 9
Running: 8
Paused: 0
Stopped: 1
Images: 5
But, when I run docker container ls -a or docker ps -a Then I see nothing running there.
I can see the 5 running Images when I do this: docker images -a ,
REPOSITORY TAG IMAGE ID CREATED SIZE
k8s.gcr.io/kube-apiserver-amd64 v1.10.11 e851a7aeb6e8 3 months ago 228MB
k8s.gcr.io/kube-controller-manager-amd64 v1.10.11 978cfa2028bf 3 months ago 151MB
k8s.gcr.io/kube-scheduler-amd64 v1.10.11 d2c751d562c6 3 months ago 51.2MB
k8s.gcr.io/etcd-amd64 3.1.12 52920ad46f5b 11 months ago 193MB
k8s.gcr.io/pause-amd64 3.1 da86e6ba6ca1 14 months ago 742kB
But I'm unable to delete them.
I tried doing this: docker rmi <image_id> or even this: docker rmi $(docker images -aq)
both gave errors like this:
Error response from daemon: conflict: unable to delete <image_id> (cannot be forced) - image is being used by running container <container_id>
When I try to kill one of these "running" container IDs, like this: docker kill <container_id>, I get the error:
Error response from daemon: Cannot kill container: <container_id>: Container <long_container_id> is not running
Or, if I do docker stop <container_id> then I just get back the container ID meaning the container is already stopped I guess? and yet even After that, trying to remove the images, gives the same error.
So, how do I get rid of these running "ghost" containers and images?
if you don't need the container, you can remove the container the same way you would the image
docker rm <container_id>
then after that you should have better luck removing the image
docker rmi <image_id>
or as you had to remove all images
docker rmi $(docker images -qa)

How to stop Docker process from docker hub container busybox?

I don't have any docker containers locally, running them from docker hub.
I ran docker run busybox ping google.com
Then I closed my terminal before stopping the process. Now it seems like I can't stop the process:
➜ ~ docker ps
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES
138faab6c40f busybox "ping google.com" 4 minutes ago Up 4 minutes musing_hopper
➜ ~ docker stop busybox
Error response from daemon: No such container: busybox
➜ ~ docker stop busybox
Error response from daemon: No such container: busybox
https://docs.docker.com/engine/reference/commandline/stop/#description
$ docker stop my_container
Also tried
➜ ~ docker kill busybox
Error response from daemon: Cannot kill container: busybox: No such container: busybox
The stop command accepts the container name or id which is different from the image name, which in this case is busybox.
To stop the container, you first need to figure out its name or id, which can be found by running docker container ls and then use the Id or name as input to the stop command:
docker stop <container-name-or-id>
A good command to stop all your running docker containers, in case you closed the terminal before stopping them is:
docker ps -q | xargs docker stop

Resources