$ docker build -t hello-node:v1 .
$ docker image ls
First you need to login:
$ docker login
Storing in Docker registry:
$ docker tag hello-node:v1 <USER ID>/hello-node:v1
$ docker push <USER ID>/hello-node:v1
To run a local image locally (meaning, make sure your terminal isn't "attached" to minikube or a docker-machine):
$ docker run -p 5555:5000 hello-node:v1
To run an image from public registry:
$ docker run -p 5555:5000 gcr.io/<USER ID>/hello-node:v1
To run in the background, add -d
.
To list running containers:
$ docker container ls
or
$ docker ps
To list all containers:
$ docker container ls -a
To access the container running locally (i.e. not in Minikube nor Docker machine):
$ curl http://localhost:5555
If you built and run the containers while your terminal is attached to Minikube or a Docker machine, then replace localhost with the IP address of Minikube (minikube ip
command) or Docker machine, e.g.:
$ curl http://192.168.99.100:5555
If you're on Windows, I think you need to replace localhost with the IP address of your host.
$ docker stop <CONTAINER ID>
or
$ docker container stop <CONTAINER ID>
Or if the container is running interactively, just press Ctrl-C. On Windows, you still need to issue docker container stop <CONTAINER ID>
after hitting Ctrl-C.
$ docker rm <CONTAINER ID>
or
$ docker container rm <CONTAINER ID>
$ docker rmi <IMAGE>
or
$ docker image rm <IMAGE>
where <IMAGE>
can be their tag names or image IDs.
$ docker image prune