Following the steps.
1. Create a Dockerfile with the following content.
from fedora RUN dnf install python-pip -y RUN dnf -y install dnf-plugins-core RUN dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo RUN dnf config-manager --set-disabled docker-ce-test RUN dnf config-manager --set-disabled docker-ce-edge RUN dnf install docker-ce -y RUN pip install docker-compose CMD ["systemctl","start","docker"]
2. Run the following command to build the image based on this Dockerfile.
$docker build -t fedora-docker-in-docker .
3. Create a bash file with the following content.
#!/bin/bash docker run -d \ --rm \ --name fdid \ -e=container=docker \ --stop-signal=SIGRTMIN+3 \ --cap-add=SYS_ADMIN \ --security-opt=seccomp:unconfined \ --privileged \ -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ fedora-docker-in-docker \ /sbin/init docker exec -it fdid bash
4. Make the bash file an executable file as following.
$ chmod +x bash.sh
5. Execute the bash file created.
$ ./bash.sh bc60239b64153519012e4a4bc340eedfea4f1eed3889c2860f52e4fdf1862503 [root@bc60239b6415 /]#
Now you are inside of your fedora container with a docker instaled inside. Also, you will have permission to stop and start the docker inside of this container by running the following command for example.
$ systemctl stop docker