Different ways to host an Ubuntu environment:Chroot & Docker
Different ways to host an Ubuntu environment: Chroot & Docker
In embedded system development, some SDKs require a specific version of Ubuntu. While a virtual machine is an option, it’s usually bloated, slow, and inconvenient to use.
Let’s explore the various options for hosting Ubuntu 14.04 (amd64) as an example.
All the 14_04 below are the name of the environment, you can change it
Chroot (Linux only)
A chroot environment shares the kernel with the host system but uses an isolated userspace. While chroot requires root privileges, schroot is a tool that allows normal users to access chroot environments.
> sudo apt install schroot debootstrap
> sudo debootstrap --arch amd64 trusty /root/14_04 http://us.archive.ubuntu.com/ubuntu/
# Consider using other mirrors, eg. http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/
> cat << EOF | sudo tee /etc/schroot/chroot.d/14_04.conf
[14_04]
description=Ubuntu 14.04
directory=/root/14_04
users=$USER
root-users=$USER
root-groups=root
type=directory
EOF
> schroot -l
chroot:14_04
# Execute command in the guest system
> schroot -c 14_04 -- lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty
# Get a shell in the guest system
> schroot -c 14_04
# Run command in the guest system
> schroot -c 14_04 ls
Docker
Docker is a more modern solution, and it is not limited to Linux. You can run an Ubuntu container on a macOS host.
# Install Docker Desktop from https://docs.docker.com/get-started/get-docker/
# Don't forget to install Rosetta if you are using Apple silicon
> softwareupdate --install-rosetta
# Use a prebuilt Ubuntu 14.04 docker image
> docker pull ubuntu:14.04
# Create a docker container from the image and bind $HOME to /mnt in the container
> docker create -it --name 14_04 --mount type=bind,source=$HOME,target=/mnt ubuntu:14.04
# If you need certain architecture,
# specify it like `--platform=linux/amd64` or `--platform=linux/arm64`
# to docker pull/create command
# Start the container
> docker start 14_04
# Execute command in the container
> docker exec -it 14_04 lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.6 LTS
Release: 14.04
Codename: trusty
# Get a shell in the container
> docker exec -it 14_04 bash
While Docker is more convenient for pure software operations, chroot allows you to access USB devices, enabling you to run firmware programmer tools directly. If you don’t have a Linux host, you still have a chance to access USB with USBIP.
메타데이터
- post_id
- 2f8a98a1b692
- slug
- different-ways-to-host-an-ubuntu-environment-2f8a98a1b692
- url
- https://medium.com/@buganini/different-ways-to-host-an-ubuntu-environment-2f8a98a1b692
- canonical_url
- https://medium.com/@buganini/different-ways-to-host-an-ubuntu-environment-2f8a98a1b692
- author_url
- https://medium.com/@buganini
- status
- ok
- fetched_at
- 2026-07-21 08:25:23