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

podman build produces "SHELL is not supported for OCI image format" #8477

Closed
svdHero opened this issue Nov 25, 2020 · 10 comments
Closed

podman build produces "SHELL is not supported for OCI image format" #8477

svdHero opened this issue Nov 25, 2020 · 10 comments
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@svdHero
Copy link

svdHero commented Nov 25, 2020

Hi there,

I have Dockerfiles containing the command

SHELL ["/bin/bash", "-c"] 

for setting the default shell to bash.

When I try to build images from said Dockerfiles with podman version 2.1.1, I get the error message:
"SHELL is not supported for OCI image format".

What should I do? Do I have to modify the Dockerfiles or is there another way to do this? I thought podman was a drop-in replacement for docker. Am I missing something or doing something wrong?

@rhatdan
Copy link
Member

rhatdan commented Nov 25, 2020

You can use the --format docker flag, to support this option. This option did not make it into the OCI specification.
Podman defaults to building OCI images.

@rhatdan
Copy link
Member

rhatdan commented Nov 25, 2020

If you use buildah bud, you would get this message.
WARN SHELL is not supported for OCI image format, [/bin/bash -c] will be ignored. Must use docker format

@svdHero
Copy link
Author

svdHero commented Nov 27, 2020

Great. I did not know about the --format option. Thank you.
I will try to avoid non-OCI commands for new Containerfiles.

@svdHero svdHero closed this as completed Nov 27, 2020
@Ferryistaken
Copy link

Is there some kind of alternative to the SHELL command with OCI containers? I would like to build an OCI image but I don't really know how to transition.

@mheon
Copy link
Member

mheon commented Jul 18, 2021

I can't find any documentation on what the SHELL command actually does - it's been removed from all current Dockerfile syntax references, which makes me think it's deprecated.

I think it may be similar to the ENTRYPOINT instruction?

@Ferryistaken
Copy link

I tried building with buildah instead of podman build and it worked. It makes me think that I now have a docker formate image instead of an OCI image. How do I check if my image is OCI? Is there some tool that automatically does that?

@mheon
Copy link
Member

mheon commented Jul 19, 2021

I believe ManifestType in podman inspect is what you're looking for. application/vnd.docker.distribution.manifest.v2+json for DockerV2, application/vnd.oci.image.manifest.v1+json for OCIv1

@nezartarbin
Copy link

nezartarbin commented Oct 11, 2022

I can't find any documentation on what the SHELL command actually does - it's been removed from all current Dockerfile syntax references, which makes me think it's deprecated.

I think it may be similar to the ENTRYPOINT instruction?

@mheon I am late to this, but the SHELL command changes the default shell used by commands such as RUN, which defaults to /bin/sh by default.

Is there a OCI alternative to this? the closest equivalent would be RUN bash -c [commands] but I would have to insert bash -c everywhere, and wrapping string around commands messes up syntax highlighting, which is especially bad for long or multiple &&-chained commands in a single RUN.

@akostadinov
Copy link

How to request this feature in OCI?

@dusansimic
Copy link

@mheon sorry for the ping but I came across this same issue and researched it a bit.

I've found some info in Dockerfile reference. It seems like it's used to reduce the number of arguments for RUN instruction. Since when building an image in oci mode, this instruction is ignored, I'm guessing one could recreate it by looking at what the SHELL instruction arguments are and putting it into the RUN instruction instead. I'm not sure if that is really the case tho.

My assumption is that since Docker images are already built (I'm using one for example) and using them as a base image won't affect their contents (since they are already built), podman and buildah are just warning users that some image (in my case a base image) is built with those unsupported instructions. If a user would want to have the same behavior of the RUN instruction tho, they would need to use the run it through the shell specified in the SHELL instruction manually. Am I wrong thinking that?

Epannec added a commit to Epannec/alphafold that referenced this issue Jun 26, 2023
Podman appears to parse the [SHELL] in the Dockerfile differently as compared to
Docker. Using --format docker allows supporting this.

From: containers/podman#8477
@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 Aug 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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

7 participants