Building an Image in Docker Container
  • 12 Jun 2023
  • 1 Minute to read
  • Dark
  • PDF

Building an Image in Docker Container

  • Dark
  • PDF

Article Summary


Set up the build environment using container methods.

Set up build environment on host PC:

The build environment is tested under Ubuntu 22.04.

Install required package:

$ sudo apt install

Download TechNexion's dockerfile:

$ wget

Build the docker container:

$ sudo docker build -t tn-develop-ubuntu .

Check the built docker container:

$ sudo docker images
REPOSITORY          TAG       IMAGE ID       CREATED         SIZE
tn-develop-ubuntu   latest    b438b5e2e8fb   5 minutes ago   2.15GB
ubuntu              20.04     88bd68917189   8 weeks ago     72.8MB

Use docker container:

Use this docker container to start building Yocto image.

Create a new docker container:

$ sudo docker run -it -u jenkins -v ${directory_in_host_machine}:${directory_in_docker} tn-develop-ubuntu bash
(-v: use to bind volume to the directory in host machine to a directory in docker)
(password: jenkins)

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

jenkins@818cacdead74:/$ cd

Re-entry is required when exiting:

$ sudo docker start <your container id>
$ sudo docker attach <your container id>


$ sudo docker ps -a
CONTAINER ID   IMAGE               COMMAND   CREATED          STATUS                      PORTS     NAMES
818cacdead74   tn-develop-ubuntu   "bash"    45 minutes ago   Exited (0) 19 seconds ago             hopeful_villanir

$ sudo docker start 818cacdead74
$ sudo docker attach 818cacdead74

Was this article helpful?