Grub2 inside docker container

I may be trying to do something outside the realm of what is allowed but I am trying to enable FIPS mode for openssh for my container. One of the things I have to do is the following:
“Modify the kernel command line of the current kernel in the /boot/grub2/grub.cfg file”

When I build my container I install grub2 so it is present, but since there is not a /dev/sda present I am not sure how I can execute grub commands to modify that file, which seems to need to be edited.

After I start run my container and exec into a bash shell and any grub command I execute I get the following error:
[root@000fac72ef43 /]# grub2-mkconfig -o /boot/grub2/grub.cfg
/usr/sbin/grub2-probe: error: failed to get canonical path of `/dev/mapper/docker-253:0-469762181-580174195e27085324e12f18e080cfd1a40a21bed9bd0b83d8f43eba9c20c348’.

Is this even possible to do within a container while it is running? Thanks for the help - Gary

2 Likes