Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@mykysyk@github

CentOS7 に systemd-nspawn用 CentOS7 コンテナを作成する

More than 1 year has passed since last update.
NEW_MACHINE='centos7'
yum --releasever=7 \
    --nogpg \
    --installroot=/var/lib/machines/${NEW_MACHINE} \
    --disablerepo='*' \
    --enablerepo=base \
    install systemd passwd yum vim

sudo systemd-nspawn -D /var/lib/machines/${NEW_MACHINE}
passwd
useradd -m -r user
passwd user
exit

# 起動確認
sudo systemd-nspawn -bD /var/lib/machines/${NEW_MACHINE}
Ctrl+]
Ctrl+]
Ctrl+]

# unit file 
systemctl enable systemd-nspawn@${NEW_MACHINE}.service

(echo '[Service]'
 echo 'ExecStart='
 echo 'ExecStart=/usr/bin/systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --machine=%I'
) | SYSTEMD_EDITOR=tee systemctl edit systemd-nspawn@${NEW_MACHINE}.service

cat /usr/lib/systemd/system/systemd-nspawn@.service.
cat /etc/systemd/system/machines.target.wants/systemd-nspawn@${NEW_MACHINE}.service
cat /etc/systemd/system/systemd-nspawn@${NEW_MACHINE}.service.d/override.conf

machinectl start ${NEW_MACHINE}
0
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
0
Help us understand the problem. What is going on with this article?