title: Built-in System Services in RancherOS
To launch RancherOS, we have built-in system services. They are defined in the Docker Compose format, and can be found in the default system config file, /usr/share/ros/os-config.yml
. You can add your own system services or override services in the cloud-config.
In start up order, here are the groups of services:
acpid
syslog
System configuration and networking:
preload-system-images
cloud-init-pre
network-pre
ntp
cloud-init
network
User interaction:
console
docker
Post configuration:
preload-user-images
Read more about pre-packing Docker images.
User-data (i.e. cloud-config) and metadata from cloud provider, VM runtime, or a management service, is loaded in this service.
The user-data is written to:
/var/lib/rancher/conf/cloud-config.d/boot.yml
- If the user-data is a cloud-config, i.e. begins with #cloud-config
and is YAML format./var/lib/rancher/conf/cloud-config-script
- If the user-data is a script, i.e begins with #!
./var/lib/rancher/conf/metadata
- If it is serialized cloud provider metadata.It is configured by the rancher.cloud_init.datasources
list in cloud-config. It is pre-configured in cloud-provider specific images (e.g. AWS, GCE).
During this service, networking is set up, e.g. hostname, interfaces, and DNS.
It is configured by hostname
and rancher.network
settings in cloud-config.
Runs ntpd
in a System Docker container.
It does the same thing as cloud-init-pre, but in this step, it can also use the network to fetch user-data and metadata (e.g. in cloud providers).
Completes setting up networking with configuration obtained by cloud-init.
This service provides the RancherOS user interface by running sshd
and getty
. It completes the RancherOS configuration on start up:
If the rancher.password=<password>
kernel parameter exists, it sets <password>
as the password for the rancher
user.
If there are no host SSH keys, it generates host SSH keys and saves them under rancher.ssh.keys
in cloud-config.
Runs cloud-init -execute
, which does the following:
.ssh/authorized_keys
in /home/rancher
and /home/docker
from cloud-config and metadata.write_files
cloud-config setting.rancher.resize_device
cloud-config setting.mounts
cloud-config setting.rancher.sysctl
cloud-config setting.If user-data contained a file that started with #!
, then a file would be saved at /var/lib/rancher/conf/cloud-config-script
during cloud-init and then executed. Any errors are ignored.
Runs /opt/rancher/bin/start.sh
if it exists and is executable. Any errors are ignored.
Runs /etc/rc.local
if it exists and is executable. Any errors are ignored.
This system service runs the user docker daemon. Normally it runs inside the console system container by running docker-init
script which, in turn, looks for docker binaries in /opt/bin
, /usr/local/bin
and /usr/bin
, adds the first found directory with docker binaries to PATH and runs dockerlaunch docker daemon
appending the passed arguments.
Docker daemon args are read from rancher.docker.args
cloud-config property (followed by rancher.docker.extra_args
).
Cloud-config is read by system services when they need to get configuration. Each additional file overwrites and extends the previous configuration file.
/usr/share/ros/os-config.yml
- This is the system default configuration, which should not be modified by users./usr/share/ros/oem/oem-config.yml
- This will typically exist by OEM, which should not be modified by users./var/lib/rancher/conf/cloud-config.d/
ordered by filename. If a file is passed in through user-data, it is written by cloud-init and saved as /var/lib/rancher/conf/cloud-config.d/boot.yml
./var/lib/rancher/conf/cloud-config.yml
- If you set anything with ros config set
, the changes are saved in this file.rancher
./var/lib/rancher/conf/metadata
- Metadata added by cloud-init.