Welcome to the Linux Foundation Forum!

Lab 3.3 - systemd-nspawn - login to container

Lab 3.3 goes through the process of debootstrapping a container and booting it. However, the explanations stop short at how to actually login and use that container.

Searching the WWW I found the answer. Before running systemd-nspawn -bD ~/DebianContainer/, run the following:

  1. root@ubuntu:~# systemd-nspawn -D ~/DebianContainer/
  2. Spawning container DebianContainer on /root/DebianContainer.
  3. Press ^] three times within 1s to kill container.
  4. Host and machine ids are equal (a006ae0037b045dd8276dd6252395133): refusing to link journals
  5. root@DebianContainer:~# passwd
  6. New password:
  7. Retype new password:
  8. passwd: password updated successfully
  9. root@DebianContainer:~# exit
  10. logout
  11. Container DebianContainer exited successfully.
  12. root@ubuntu:~# systemd-nspawn -b -D ~/DebianContainer/
  13.  

It's very simple, but without it the entire exercise is like travelling to Ghiza (Egypt) and not seeing the pyramids.

Comments

  • Posts: 2,434

    Hi @heiko_s,

    Thanks for your feedback. This is an elegant method indeed.
    You can also hack your way into the container by editing root entry in the /root/DebianContainer/etc/passwd file.

    Regards,
    -Chris

  • Posts: 99

    Thanks Chris!

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training