Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker compose fails to pull podman images #18843

Closed
SureshGota opened this issue Jun 10, 2023 · 13 comments
Closed

Docker compose fails to pull podman images #18843

SureshGota opened this issue Jun 10, 2023 · 13 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@SureshGota
Copy link

SureshGota commented Jun 10, 2023

Issue Description

I am working on a windows and have installed Podman. Inside the default WSL created by Podman I have installed docker compose.

Here's my compose file,

version: "3.9"
services:
    configurationsService:
        image: "localhost/configurations"
        hostname: configurationsService
        ports:
          - "51005:51005"
        restart: always
**Docker Compose** version v2.15.1

**Podman Version**
Client:       Podman Engine
Version:      4.5.0
API Version:  4.5.0
Go Version:   go1.19.7
Built:        Fri Apr 14 21:12:56 2023
OS/Arch:      linux/amd64

Steps to reproduce the issue

I have built the images using podman build command and I can see them when I list them as podman images. I am also able to run the images using podman run command.

However when I run docker-compose up it fails while trying to pull the image
with the error initializing source docker://localhost/configurations:latest: pinging container registry localhost: Get "https://localhost/v2/": dial tcp 127.0.0.1:443: connect: connection refused

if I remove the localhost prefix from my image name it tries to connect to docker.io and fails there as well.

To triage I have installed podman compose which works fine but I want to use docker compose for my work and it for some reason fails to work as expected.

How do I make it work with local machine as the image repository?

Describe the results you received

Fails to pull the images from local machine.

Describe the results you expected

Run all the docker compose images successfully.

podman info output

NA

Podman in a container

No

Privileged Or Rootless

Privileged

Upstream Latest Release

Yes

Additional environment details

Additional environment details

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

@SureshGota SureshGota added the kind/bug Categorizes issue or PR as related to a bug. label Jun 10, 2023
@Luap99
Copy link
Member

Luap99 commented Jun 12, 2023

@vrothberg PTAL

@vrothberg
Copy link
Member

Thanks for reaching out, @SureshGota!

Do I understand you correctly that the localhost/configurations is present in the local image store? With exactly this name/tag?

@SureshGota
Copy link
Author

SureshGota commented Jun 12, 2023

@vrothberg yes its the local image store.

I was successfully able to run he same yaml file with dockerD and docker image store, But with podman & docker compose it fails to pull images.

when I prefix with localhost/imageName it fails with the error initializing source docker://localhost/configurations:latest: pinging container registry localhost: Get "https://localhost/v2/": dial tcp 127.0.0.1:443: connect: connection refused

If I remove the prefix localhost and try, this time it fails while connecting to docker.io but its an authentication related failure.

@vrothberg
Copy link
Member

Thanks, @SureshGota ! I will investigate and report back soon.

@vrothberg
Copy link
Member

I tried with Podman v4.5.1 and am unable to reproduce. Ultimately, the error from Podman indicates that the image is not present in the local storage (or cannot be found). Can you share the output of podman images? Are you running podman and docker-compose under the same user?

@SureshGota
Copy link
Author

SureshGota commented Jun 12, 2023

@vrothberg Thanks for your help. I would like to add some info that might aid your investigation.

I ran a sample docker-compose to run ngnix and redis image that was stored on docker.io. This ran successfully, however when I did podman images I couldn't find these images but docker-compose images showed me both ngnix and redis images which were removed only after I did docker-compose down.

@SureshGota
Copy link
Author

@vrothberg Did you install docker-compose manually? I did this step additionally.

I am running both as same user but for running docker-compose I need to sudo.

image

@vrothberg
Copy link
Member

[...] but for running docker-compose I need to sudo

In this case, docker-compose will probably talk to the rootfull podman not the one of your non-root user. If you a sudo podman images, the localhost/.... one will not show up.

Why do you need to run docker-compose as root? Dropping the sudo or making the image available for root should resolve your issue.

@SureshGota
Copy link
Author

Good catch. Yes, when you do sudo podman images I do not see localhost/...

The reason I run docker-compose with sudo is because of this error permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json?all=1&filters=%7B%22label%22%3A%7B%22com.docker.compose.project%3Dcode_repo%22%3Atrue%7D%7D": dial unix /var/run/docker.sock: connect: permission denie

@vrothberg
Copy link
Member

If you want to point docker-compose to the rootless Podman socket, you can point it via an env variable: export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock

Is it working for you?

@SureshGota
Copy link
Author

@vrothberg This works, thank you so much.

I have a question an addon question, I have my database running on my windows host. I have added the below config in my compose file but looks like the containers are not able to access the host service. Any advice on this?

  extra_hosts:
            - "host.docker.internal:host-gateway" 

@vrothberg
Copy link
Member

I have added the below config in my compose file but looks like the containers are not able to access the host service. Any advice on this?

I am not sure if that works today. @Luap99, do you?

We may need to create a separate issue for it.

@Luap99
Copy link
Member

Luap99 commented Jun 13, 2023

There is #14390 for that.
Right now we only have our own host.containers.internal entry which is added by default.

I am closing this one as the pull thing is resolved.

@Luap99 Luap99 closed this as completed Jun 13, 2023
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 12, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

3 participants