*** This project is no longer actively maintained ***
This project creates docker images which can be used as a containerized build environment for the Yocto project.
- Containerized build environment without user permission issues
- The required package dependencies are installed for building with the current Poky release Hardknott
- The ncurses dev package is installed allowing menuconfig to be used inside the container
- Dumb init is used to make sure that the build processes receive the correct signal to terminate
Choose one of the following:
Docker Images |
---|
elcfd/bitbake:ubuntu-16.04 |
elcfd/bitbake:ubuntu-18.04 |
elcfd/bitbake:ubuntu-20.04 |
Pull the image from docker hub:
docker image pull <image_name>
To run the container:
docker container run -it --rm -v /workdir:/workdir <image_name>
Where /workdir is the location on the host PC that is going to be mounted into the build container.
NB. The workdir passed into the container, can be any valid path on the host but must not be owned by the root user.
If the previous command was successful the shell will now be inside the container:
bbuser@b4e96c8d231c:/workdir$
To run the container with a different workdir inside the container:
docker container run -it --rm -v /yocto-dev:/yocto-dev <image_name> --workdir=/yocto-dev
NB. On most images the default user inside a docker container is root. This causes permission issues when mounting a folder from the host to inside a container. These images are built so that when the container is started the ownership permissions on the folder being passed into the container are reflected inside the container. This means that switching between the folder on the host and inside the container is seamless.
The suggested workflow is to use the host PC for project version control and editing files with the container used as the build environment. Follow the instructions here but run bitbake from inside the container.
The following dependencies are required for development:
- docker
- task
- python3
- pytest
The build process is specified using the manifest so if required edit this.
The command to build is:
task build
The command to run the unit tests is:
task test
NB. The unit test test_user_2_id requires sudo to run so will prompt for the sudo password.
The command to push the built images is:
task release
NB. Successful authentication with Dockerhub must have been completed before running this command.
For the three commands; build, test and release the default target is all. This means that all of the images specified in the manifest will be used. However, this can be overridden for example:
- To only build the
ubuntu-16.04
andubuntu-18.04
images:
task IMAGES=ubuntu-16.04,ubuntu-18.04 build
- To only test the
ubuntu-20.04
image:
task IMAGES=ubuntu-20.04 test
- To build, test and release only the
ubuntu-20.04
image:
task IMAGES=ubuntu-20.04
This work is based on crops/yocto-dockerfiles and crops/poky-container - thanks is given.