Can't run scripts in the Docker container with Fedora 36

,

I am not able to run perl and bash scripts in Docker container with Fedora 34 or 36.
I have also Fedora 34 on my Host.

When I run in container the bash script I see:

[root@0fbb84933e85 /]# ./command.sh
sudo: unable to stat /etc/sudoers: Operation not supported
sudo: no valid sudoers sources found, quitting
sudo: error initializing audit plugin sudoers_audit

When I try to run perl scipt I see (perl package is installed):

[root@11efb25fa64f perl]# perl ./launch-commands.pl
Can’t open perl script “./launch-commands.pl”: Operation not supported’

My base image for Fedora was downloaded form Docker Hub: Docker
I guess that base image might be very lightweight without many packages, required configurations etc. and thats why I am not able to execute perl and bash script. This is my assumption, so what should I configure to execute them both in contianers?

Important note, those two perl and bash script works on my Host without any issues, but they do not work in the container with Fedora 34/36.

How are you launching the container?

Are you using the docker package from Install on Fedora | Docker Documentation, or via podman, or in some other way? What command-line options are you using?

Can you provide your Dockerfile so we can see what you’ve done on top of the base image?

And, for that matter, what is in command.sh?

This is basically true, although it’s still not as lightweight as I’d like it to be. :classic_smiley:

However, bash scripts should work in general, and so should perl (once you’ve installed that package, of course). Something else is going wrong, somewhere…

I am not using Dockerfile, this is a base image from Docker Hub.

All commands which I run:

docker pull fedora:36 → based on Docker
docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
fedora 36 0e68c6a5f825 6 weeks ago 165MB

Then:

docker run -it --name script fedora:36
docker start script
docker exec -it script bash

And then in the cointainer:

dnf install perl → there was not perl package
[root@11efb25fa64f perl]# perl ./launch-commands.pl
Can’t open perl script “./launch-commands.pl”: Operation not supported’

Or for bash script:

[root@0fbb84933e85 /]# ./command.sh
sudo: unable to stat /etc/sudoers: Operation not supported
sudo: no valid sudoers sources found, quitting
sudo: error initializing audit plugin sudoers_audit

Bash script configures ip interfaces and assigns them IP.

I am using Docker, I found one tutorial on web but not that one which you pasted.

Server Version: 20.10.17
Storage Driver: fuse-overlayfs

Two things:

#1. Fedora 34 is end-of-life and I recommend upgrading to at least Fedora 36 ASAP

#2. If you want Fedora with sudo to work in a container out of box, check out Container Toolbx, which makes doing what you’re trying to do here very easy.

As I see in that article Container Toolbx works with Podman, and I have Docker.

I will update one day my Fedora but I do not think so that my issue is related with older version of Fedora.

Can you try this with replacing docker with podman? It should be drop-in compatible [1].


  1. mostly in general, and definitely in this situation ↩︎

1 Like

Your version of Fedora won’t be getting any updates, security or otherwise, so please upgrade it anyway.

If you really want to use docker specifically and not podman for some reason, you might check out DistroBox which is a similar concept that supports Docker. It’s available in the Fedora repos (at least for Fedora 37).

Just needs to be done with Docker. I start learn Docker and would like to switch to another tool.

Looks promiscuous, but I treat it as workaround not to solve my issue. I think it might be related with my Host OS (Feodra 34), or maybe Docker configuration and would be best to know the reason of the above failures.

I’m not suggesting you switch permanently. (That’s a separate issue.) I’m hoping that using the different tool will help us narrow down the problem.

1 Like