Nakul Desai:
Hi Folks
Just wanted to know… I have created django application Image by using DockerFile just wanted to know “How to Run Locally Built Docker Images in Kubernetes kind cluster using docker-compose file” ?
could you please help me out?
Al West:
So Kubernetes does not use docker-compose files. To run your Django app you can either use the command line (imperative):
kubectl run django --image django
or supply a yaml file (declarative):
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: django
name: django
spec:
containers:
- image: django
name: django
and then save it as django.yaml and apply it with:
kubectl apply -f django.yaml
Nakul Desai:
@Al West thank you…but just wanted to know like if I wanted to use locally created image in pod how to achieve this?
Al West:
you’d have to add the image to a registry to use it
Nakul Desai:
@Al West I have Ubuntu also while trying to execute “docker login” command in CLI I am not able to log into docker registery. I am getting below error
“Error saving credentials: error storing credentials - err: exec: “docker-credential-desktop”: executable file not found in $PATH, out: ``”
Al West:
how did you install docker? With snap?
Nakul Desai:
Installed docker using command
apt install <http://docker.io|docker.io> -y
Al West:
I never use the distribution version of Docker, as it is usually out of date. I would install direct from docker:
https://docs.docker.com/engine/install/ubuntu/
Or you can try to edit ~/.docker/config.json and add ths:
{
"credsStore": "pass"
}
Nakul Desai:
ohkk…got it I will try this one and will get back to you…thanks
Nakul Desai:
In ~/.docker/config.json I have
{
"credsStore": "desktop"
}
Al West:
change it to pass
Nakul Desai:
yes I have tried but giving the same error
Al West:
did you restart docker?
Nakul Desai:
yes tried giving this same kind of error
“Error saving credentials: error storing credentials - err: exec: “docker-credential-pass”: executable file not found in $PATH, out: ``”
Al West:
Move the config.json file out of the .docker directory and restart docker
Nakul Desai:
yaa…this one work thanks so should I put config.json file again into .docker/ again or its ok to place outside of that dir.
Al West:
just leave it out as it seems to be interfering with the credentials manager
Nakul Desai:
ok sure… just let me help in the flow…so now I can push locally created image into registry and will create Docker-compose file to pull that image to create container is this right?
Nakul Desai:
Also just wanted to know the reason behind the getting error for config.json file?
Al West:
Credentials setting was incorrect. Again, I wouldn’t install Docker using distribution package and would only get Docker direct from the Docker project.