I'm trying to use kubernetes locally. Thus I installed minikube. When I create deployment object, pods can't find the images within minikube docker registry and pods' show status as ErrImageNeverPull. To solve the problem I followed these steps:
minikube starteval $(minikube docker-env)ImagePullPolicy to Never in deployment.yaml filedocker-compose build && docker-compose up -dEven though I followed all these steps images for the project not being created within minikube registry. I have double checked it by running this command eval $(minikube docker-env -u) in order to switch back to the local docker registry. Images and Containers have been created within local docker registry.
My question is how can I create docker images within minikube docker registry?
I have solved the problem by following these steps:
minikube start I ran minikube -p minikube docker-env and it returned following:

I executed eval $(minikube -p minikube docker-env)
docker-compose commands.Images and Containers was created within minikube docker registry.
To be honest I don't know why eval $(minikube docker-env) didn't do the job and the differences between eval $(minikube docker-env) and eval $(minikube -p minikube docker-env).
If you know the reason please let me know.
Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.
eval didn't work, because the eval is made for docker binary, not docker-compose. Use a Dockerfile to run docker build and it should be registered directly to Minikube Image Registry.from Minikube Documentation: Comparing 5 ways to push your image into a minikiube cluster, the best way to do it is as describe below:
My question is how can I create docker images within minikube docker registry?
minikube ssh and you can build the images directly on the Minikube VM. The Docker environment is already set there:$ minikube ssh
_ _
_ _ ( ) ( )
___ ___ (_) ___ (_)| |/') _ _ | |_ __
/' _ ` _ `\| |/' _ `\| || , < ( ) ( )| '_`\ /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )( ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest e791337790a6 3 days ago 127MB
nginx <none> ed21b7a8aee9 2 weeks ago 127MB
ubuntu latest 4e5021d210f6 4 weeks ago 64.2MB
docker build to register the images into the registry. docker-compose is not baked inside Minikube VMLet me know in the comments if you have any doubt.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With