Target commands are executed within the root filesystem which we are just building. This concept is similar to the one of Docker.
The key benefit of using those commands is, that it is very natural. You can automate virtually every command, which you would use to configure the system manually in your terminal.
When you build a system for a foreign architecture, Wharfie uses Qemu to.be able to execute the commands on your x86 host.
Run gets exactly one argument. This is the command, which should be executed on the targets root filesystem. This command can be multiline.
For example:
RUN apt-get install -y psutils \
openssh-server ...
The Backslash () at the end of the line indicates, that the command continues in the next line.
If you want to install a new software on your target image, you most likely want to use apt. To avoid apt and dpkg from requesting inputs from the user, you can pass "-y" to apt-get.
For example:
RUN apt-get install -y tzdata
In case you want to deviate from the default, you might want to use dpkg-reconfigure after the installation.
RUN Echo Antarctica/Mawson > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata
An easy, non-interactive way to add a user and set his password is to use the tools "useradd" and "chpasswd".
This example adds the user "wharfie" with the password "secret":
RUN useradd -ms /bin/bash wharfie; echo "wharfie:secret" | chpasswd;