-
Notifications
You must be signed in to change notification settings - Fork 34
Create Templates from CLI
This document describes steps that should be performed to build custom Subutai template based on the Debian Stretch base image.
To build new Subutai template you need following:
-
Subutai Resource host with the latest version;
-
Imported debian-stretch image to the system:
# subutai import debian-stretch
INFO[2016-05-02 12:17:56] [Importing debian-stretch]
INFO[2016-05-02 12:17:56] [Version: 4.0.0, branch: dev]
INFO[2016-05-02 12:17:56] Trying local repo, dial tcp 10.10.10.1:8339: getsockopt: no route to host
INFO[2016-05-02 12:17:57] [Downloading debian-stretch]
73.09 MB / 73.09 MB [==============================================================] 100.00%
INFO[2016-05-02 12:18:13] [Unpacking template debian-stretch]
INFO[2016-05-02 12:18:15]
[Installing template debian-stretch]
#
- First of all you need to clone debian-stretch template to container with required name:
# subutai clone debian-stretch nginx
INFO[2016-05-02 12:22:58] [nginx started]
INFO[2016-05-02 12:22:58] [nginx with ID CEDFD8418B76AB41DC61F14E17C6825041D0A834 successfully cloned]
#
- Attach container to execute installation commands inside container:*
# subutai attach nginx
(amd64)root@nginx:/#
- Install required software into container:*
(amd64)root@nginx:/# apt update; apt install nginx -y
Debian Stretch (9.x) uses systemd for service management.
Most of the services installed from Debian repositories provide the correct services that will be started after the container comes up.
But if you need to configure custom service or check that your services active you will need following command:
-
systemctl status nginx
shows current status of nginx.service; -
systemctl start nginx
starts nginx.service; -
systemctl stop nginx
stops nginx.service; -
systemctl enable nginx
enables nginx.service auto start after system boot; -
systemctl disable nginx
disables nginx.service auto start after system boot.
If you need add custom systemd service to the container that was not included after installing your software, you can add systemd unit file that describes required service
Put file with any name with .service suffix like sleep.service to the following directory: /etc/systemd/system/sleep.service
Minimal file should look like following:
[Unit]
Description=MyApp
[Service]
ExecStart=/bin/sleep 9999
[Install]
WantedBy=multi-user.target
After these operations you can use systemctl commands to manipulate your service:
To finish template preparation you just need to export your container:
# subutai export nginx -t {cdn-token}
INFO[2016-05-02 12:48:42] [nginx promoted]
INFO[2016-05-02 12:48:45] [nginx exported to /var/snap/subutai/common/lxc/tmpdir/nginx-subutai-template_4.0.0_amd64.tar.gz]
#
See https://github.com/subutai-io/bazaar/wiki/How-to-obtain-CDN-token
User Guides
Glossary
Components
How it works
Configure domain for environment
Create Templates from CLI
Create Templates from Console
Environment management via Bazaar and Console
EZ Desktop solution for Subutai containers
[Linux] Adding domain name to etc hosts
[Windows] Adding domain name to etc hosts