-
Notifications
You must be signed in to change notification settings - Fork 785
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
podman build tags images in the local registry with a leading localhost/ and docker does not #1034
Comments
Thanks for the problem report @bowlofeggs . Thanks for the thorough problem report, can I bother you to reply with the output of podman/buildah build/bud should be a drop in replacement for docker and we'll take a look at this. However, I thought this had bubbled up before, @nalind or @rhatdan do you recall? I didn't find it in the issues, but may have missed it. |
Sure thing!
|
Well it is intended to be a drop in replacement for the most part. The localhost versus docker.io was intentional. The registry component of an image should indicate where it came from. And we don't want to hard code the default location of docker.io. Now if podman can not instantly run the image created by buildah or podman build, then that is a bug. |
It seems like podman run is not looking into localhost if the name containers a repo and a name @baude could you take a look.
Fails.
Works. Our image name processing is failing if the repo is specified. |
For me using master, neither work ... ill look at it sure. |
I believe this is fixed in the latest release. |
I'm hitting this issue with |
It should be in Master branch, and we are working on a podman-0.12.1 right now. |
I'm using podman 1.6.2 and still seeing this issue of images being prefixed with "localhost/". Should this still be the case? This makes compatibility with docker scripts difficult as the image names aren't the same. |
I'm still seeing it on v1.8.0 too, but thought it had been fixed. I'm going to reopen this so it can be chased down. |
@TomSweeneyRedHat do you know of a work around that I can use until this is fixed? Is there a way to tell podman to not prefix the tag with "localhost/"? |
I tried playing with it, but I didn't find a quick clean way to do so. However, when referencing the image, you can ignore the 'localhost/' part of it. For instance, in the above example you could do:
and that works, does that make it better for your use case @jschewebbn ? |
The problem that I have is that I'm creating images and then saving them to a docker archive file to transfer and the names of the images have "localhost/" prefixed and then when I try and load the images from the file on the other end with a script not expecting the "localhost/" the script fails. |
@jschewebbn can you tell me the commands that you're using to save the docker archive file and then the command(s) the script is not happy with when trying to load it? I tried playing with buildah push/pull to a docker-archive and I wasn't seeing the localhost in that output or the inspects that I did. These are the play commands that I used:
|
This command creates the archive without error:
Now in another environment docker is used to load the file. This fails because "container_name" doesn't exist, instead "localhost/container_name" exists.
I also want to be able to save multiple container images in a single archive file and podman doesn't support that right now per containers/podman#2669, so this is all really moot until I have another solution for that problem as well. |
The workflow that I've been doing with docker is this:
Copy archive.tar to another host.
Perhaps I'm doing some things incorrectly as my docker knowledge is pretty basic. |
Same issue here. This seems to create issues with pushing the image to Dockerhub. |
@vrothberg PTAL, I think this is around the saving with multiple images? |
It's a different issue although it affects save and load as well. Podman and Buildah is prefexing short images (or not fully-qualified images without a domain/registry) with "localhost/". That's inconsistent with Docker's behaviour but consistent among Podman and Buildah. Personally, I don't like the "localhost/" because the tools don't what I want them to but I also see wisdom explicitly enforcing fully-qualified image names. I am closing the issue as changing the behaviour will very likely break users who already rely in the "localhost/" prefixes. However, in some cases it might cause issues migrating from Docker to Podman/Buildah. |
I take this closing of the ticket to mean that podman does not want to be compatible with docker. This will make it very difficult for those of us advocating people move from docker to podman as they now have an incompatibility that there is no work around for. If podman were to have a command line option to suppress this "localhost/" prefix that would be sufficient. Then I could tell people that podman save works just like docker, except you need this extra flag and it works. |
@jschewebbn, thanks for continuing the conversation! Did you encounter a migration issue regarding this behaviour? Podman will treat "foo" and "localhost/foo" as the same image, so scripts that operated on Docker can safely migrate over to Podman as "foo" will implicitly resolve to "localhost/foo". However, |
I don't know what a migration issue is. I've been following this issue as this is the problem that I'm having. In my specific use case I would like to create images with podman and then load them with docker. See #1034 (comment) for the details. |
So you want podman save of foo to save it as docker.io/library/foo? |
I want For example when I execute [
{
"Config": "cd998886946a19daf9b43f35476427b9e800999f343ca463eae89f4570c10cc9.json",
"RepoTags": [
"foo:latest"
],
"Layers": [
...
]
}
] When I executed [
{
"Config": "cd998886946a19daf9b43f35476427b9e800999f343ca463eae89f4570c10cc9.json",
"RepoTags": [
"localhost/foo:latest"
],
"Layers": [
...
]
}
] The key here is the prefix on the "RepoTags" property. The {
"foo": {
"latest": "cdd290f400b43594611786fe015d8f78205421db0bd8afbbf3a12d55fffdd1ed"
}
} podman shows {
"localhost/frc":{
"latest":"92b78c85f2b4b16c8ea4f6235af775f09d227062270fdd84bd7052c19d850528"
}
} |
…docker easily. Workaround for containers/buildah#1034.
…docker easily. Workaround for containers/buildah#1034.
I'm trying to move from docker to podman, and tried to bring up a docker-compose stack by pointing docker-compose to the podman unix socket. I have to change the image names of my locally built images in my docker-compose.yml file to have the localhost/ prefix or it doesn't work. The postgres and rabbitmq images are fine as-is. So this is another case where podman is not a drop-in replacement for docker. Perhaps working with docker-compose is outside the scope of the podman project. I was just looking for the simplest possible way to get my project moved over while I learn about podman. EDIT: I just found the page https://www.redhat.com/sysadmin/container-image-short-names and learned about image name aliases. This solves my problem at the expense of having to edit /etc/containers/registries.conf. |
Please open a new issue on this. The bottom line is we recommend you use long names, rather then rely on Docker.io always being the default. |
The images from docker.io worked fine, it was the locally built ones that podman puts It looks like this was a design decision by the podman team, so it's not a bug. I put my comment in because google brought me to this issue and I thought it might be useful for others to see another option for getting around that when google brings them here. |
Right locally built images do not default to any registry. Perhaps a modification to this would be to allow users to specify a default registry, to eliminate this problem. |
If you want us to hard code docker.io prefix, then no it is not. |
Must there be a prefix at all? |
I don't believe we can support ""/imagename |
+1 for removing the |
What are you running your k8s yaml files with? podman kube play? |
I for one have changed all my CI's and habits to explicitly say |
Explicit is nice in one sense. It makes intentions clear to others. That's why I like the POSIX --someexplicitoptionname convention over -s. However, if you want Podman to be interchangeable with Docker, it's a show stopper. If you want to force individuals, groups and companies to choose between Docker and Podman, then keep the localhost prefix. This issue is so old, I don't know why it came up now. I long ago abandoned it and forgot I had a watch on it. |
I'm using Podman to build images, Podman Desktop to get the images to the kind cluster, and kubectl to start the containers given a yaml file. |
Docker defaulted the locally built image to docker.io, hard coding their business use case into their tooling. Podman will not do the same. Images should be pushed to a container registry, at which point they will be named with the registry. localhost/image will become docker.io/image if pushed to docker.io or quay.io/image if pushed to quay.io. |
Actually the locally built docker images don't have any prefix associated with them. With podman they have "localhost/". The workflow that is a problem is exporting the locally created images and sharing them as they have different names when created in podman than when created in docker. |
Docker will always normalize short names to docker.io. So an image I can imagine adding an opt-in mechanism to avoid the |
If you have an example of a docker-compose script that blows up in this manner please open a new issue. Podman should be able to compensate and find an image based on shortname if built locally. BTW Is this happening on a MAC or Windows Box? |
This is on a Linux box and my particular problem isn't that podman isn't able to compensate, it's that the images exported from podman are not the same as the images exported from docker and therefore when imported into docker there are problems because the names have the "localhost/" prefix. See #1034 (comment) for a detailed explanation of the issue that makes podman images incompatible with docker and therefore makes it harder for docker developers to adopt podman. My fix is to run #1034 (comment) after saving images from podman before passing to someone that is using them with docker. |
What about this as a possible solution? Instead of removing the So if my DockerFile is referencing It could be setting possibly to tell podman to use it's own It makes sense to me why the repo name tag prefix is there - that provides clarity as to the origin of the image. I came across this issue when attempting to use C# (.NET) and MS SQL (dotnet-mssql). During the build process it creates a temporary image tag and expects to be able to use it w/o the I'm looking for a way around it by possibly manually building the images that devcontainer command would and modifying the docker-compose.yml file, but if podman was aware of it's |
Please open new issues or discussions. |
Description
Does
podman build
have the goal of being a drop-in replacement for docker? If not, feel free to close this issue. If so, the issue is thatpodman build -t bodhi-ci/f27
tags the resulting image into the local engine with a leadinglocalhost/
in the repository name, anddocker
does not do this. This results in a difference in how the image must be referenced later when runningdocker/podman run
, becausedocker run… bodhi-ci/f27
will work, butpodman run… bodhi-ci/f27
will not work (and will try to find that image in a variety of external registries).Steps to reproduce the issue:
Dockerfile
withpodman
anddocker
, and use the-t
flag.-t bodhi-ci/f27
in the examples shown below.Describe the results you received:
Describe the results you expected:
Output of
rpm -q buildah
orapt list buildah
:Buildah is not installed, but the text at https://github.com/containers/libpod/issues/new said to file issues with
podman build
here.Output of
buildah version
:See above.
Output of
cat /etc/*release
:Output of
uname -a
:Output of
cat /etc/containers/storage.conf
:The text was updated successfully, but these errors were encountered: