-
Running a docker image with port mapping -
docker run --init -p 4444:4444 --rm <IMAGE_NAME>
--init
makes it respond to signals like ctrl+c-d
will make it run in detached mode, so for stopping you'll have to dodocker ps
and use the container id.
By default, minikube tries to pull images from docker hub and produces ImagePullBackoff
error if a local image is used.
Minikube uses its own docker daemon and not the Docker Desktop daemon. Therefore, the images created outside of minikube daemon are not available within its environment.
Here is how local images can be used in minikube:
- Run the following command in shell:
eval $(minikube docker-env)
. - Create the docker image using
docker build
command. - Set the
ImagePullPolicy
toNever
for the pod or deployment using that image. - Reset the environment to use the docker desktop daemon using command:
$(minikube docker-env -u)
- Ssh into minikube environment:
minikube ssh
- Run the image using
docker run
. - Ssh into the minikube environment from another shell and test the connectivity using curl.