I have figured out how to how to automate Fedora install by kickstarting from netinstall image. But in order to do so, that kickstart file needs to be network accessible. I will use nginx (a popular web server…among other things) in a container to host this kickstart file on my network.
There are numerous ways to host a kickstart file for use when booting. I could use an NFS share, for instance, and that would be pretty straightforward to set up. However, I would like to learn more about containers and nginx, so I will start an nginx container for the sole purpose of hosting my kickstart file.
FULL DISCLOSURE: I decided to use a volume in my container that is actually on an NFS share on the container’s host…so, as usual, I’ve overly complicated things. All the same, here is what I’ve done:
01 Add myself to the “docker” group
Because of security and root and yadda yadda (I should provide some links with this monotonous conversation…) you must put yourself in the “docker” group in order to run
docker commands without sudo. Because I’ll be running a lot of them, go ahead and save myself the step by adding myself to that group:
sudo usermod -aG docker $USER
02 Create/locate/move your kickstart file
I have the kickstart file that I’ve been working on hosted in a private Gitlab repository. It is private not because I am selfish (although I am), but because I’m really still trying to figure things out and I’m embarrassed by my ignorance. All the same, place your kickstart file in a location on your host that will be presented to the container.
There are various methods of exposing the file to be hosted, but I have opted to house the file on the host and just tell Docker to mount that location within the container into the default location where nginx servers files from. This appears to be the simplest solution for the situation I’m facing.
NOTE: the volume where I’ve placed my kickstart file is on a NAS so that when my container host goes away (it is a test VM) I can still use these steps as long as the place I’m running the container again has the same mount…
03 Start up the container
I have decided to use the actual offical nginx container which makes things very easy:
docker run --name nginxKS -p 8080:80 \ -v /bigboy/data/nginx/html:/usr/share/nginx/html:ro -d nginx
NOTE: I used the following flags:
--name: this is self explanatory
-p: this exposes port 8080 and maps it to port 80 (which is nginx’s default)
-v: this is for “volume” which mounts
/usr/share/nginx/htmlwithin the container (and the
:romakes it read-only
-dstarts the container as a daemon (this is a guess because I haven’t tracked down the documentation)
You can test that the kickstart page is being served correctly by accessing it from another system:
WHAT I LEARNED
- This isn’t so hard…
- This is the main article I used as reference (it is a subset of a similar page available from nginx): https://blog.docker.com/2015/04/tips-for-deploying-nginx-official-image-with-docker/
- I also found some useful information here: https://hub.docker.com/_/nginx/
To avoid tl;dr enjoy this instead:
## 01 Add myself to the “docker” group sudo usermod -aG docker $USER ## 02 Create/locate/move your kickstart file ## 03 Start up the container docker run --name nginxKS -p 8080:80 \ -v /bigboy/data/nginx/html:/usr/share/nginx/html:ro -d nginx ## ...test curl http://<DockerHostIP>:8080/<KSfile>