cecilkorik,
@cecilkorik@lemmy.ca avatar

A Dockerfile is basically just a script that starts a container image (ranging from standard Linux OS installs like ubuntu or debian or alpine to the very specialized pre-made containers with every piece of software you want already installed and configured and everything unnecessary stripped away) and then does various stuff to it (copies files/dirs from local, runs commands, configures networking). It’s all very straightforward, and if you know how to write a bash script or even just a basic batch file that’s pretty much all its doing, and the end result is a container, which is basically a miniature Linux virtual machine (that is supposed to be “single purpose” but there’s no technical limitation forcing it to be)

The simplest way to create a container is to use a standard OS container as I mentioned and install the software you want exactly as you normally would in that OS, using the OS package manager if you want, following tutorials for that OS or installing manually using the instructions from the software itself. Either way should work fine. Again, it’s basically not much different from having a virtual machine running that OS. You can even start up a root bash prompt and install it that way if you prefer, or even connect over ssh by running an sshd server on it (although that’s totally uneccessary and requires extra work).

For basic Dockerfile syntax, look at other people’s Dockerfiles and realize you probably don’t need 90% of the more complex ones. There are millions of them out there, you should be able to find some simple straightforward ones and just mimic those. Will you run into “gotchas”? Sure you will, Docker is full of them, and when you do your Dockerfile will get a little more complex as you find a way to deal with the problem Docker has created for you. Here’s a pretty simple tutorial example of a Dockerfile that just installs a bunch of packages from Debian and doesn’t even run any specific services, or alternatively here’s a Dockerfile that does nothing but run and configure an ssh server like I mentioned above (again that’s totally unnecessary normally but the point is you can certainly do it if you want to!)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • uselessserver093
  • Food
  • aaaaaaacccccccce
  • [email protected]
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • Socialism
  • KbinCafe
  • TheResearchGuardian
  • oklahoma
  • feritale
  • SuperSentai
  • KamenRider
  • All magazines