I’m trying to build a basic app consisting a basic front-end and back-end. In the back-end I use official docker library of python using import docker
.
Here is the problem, since I run the front-end and back-end as a separate single containers I need to use some kind of persistent volume for back-end to use the docker socket of the host device. When I follow this procedure it works fine. However, I will deploy this app to a Kubernetes cluster and there wont be any docker socket to map. Consequently, the calls, using docker lib, such that docker.login(...)
cannot bind the socket so returns an error.
As far as I know, I can use docker in docker for this problem but I have no experience and have no idea if it is the ideal solution for my problem. I have two different ideas, too.
1- I can create an image with python then install docker inside that image.
2- I can create a image with Linux distribution (alpine, Ubuntu, etc.)
Which way works better for me any idea would be appreciated.
Edit_1:
I created docker in docker image it detects docker commands; yet, when I try to write sth like docker ps
it gives:
error during connect: Get "http://docker:2375/v1.46/containers/json": dial tcp: lookup docker on 192.168.65.7:53: no such host
I couldn’t figure it out yet.
4