Abstract
Setting up an embedded tool chain on a local PC or laptop requires very often to spend an enormous amount of time for installation and configuration of the individual software packages. It ends up in a "golden" installation on a single computer that is kept like a treasure. But with each new package installed on this computer, the golden installation is in danger.Docker provides a light weight virtualization engine that runs on Linux, Windows or MacOS.
Docker containers contain virtual guest OSes and can easily be configured, deployed and executed. The article descibes how to create a suitable container for embedded software development and how to use it.
Installing Docker
In the first step, install docker on the local PC. We use the Docker Community Edition (Docker CE). On the docker installationpage click on your OS to get the latest installation instructions.
To run docker on Ubuntu as normal user, do
- add the user to the "docker" group
sudo gpasswd -adocker - log off and log on again
$ docker run hello-world
Create the first Docker Image
Create a working directory and add the file Dockerfile in it.Edit the file Dockerfile and add the following content:
FROM ubuntu MAINTAINER Main Tainer maintainer@example.org RUN apt-get update \ # install packages && apt-get -y install \ # build system related scons mercurial \ # Python packages python python-pip \ # AVR Tools binutils-avr gcc-avr avr-libc \ # Documentation tools doxygen # we skip doxygen-latex here, otherwise the image becomes "huuuuge" RUN useradd -ms /bin/bash uracoli USER uracoli RUN mkdir /home/uracoli/work WORKDIR /home/uracoli/work # command is running at start of the container CMD \ echo == starting uracoli-development environment == \ && /bin/bash
To create the image run the command:
$ docker build -t my-uracoli-env .
The command creates an image named "my-uracoli-env".
It inherits from the latest Ubuntu installation. The "RUN" commands
- install the standard Linux packages required to compile the µracoli project
- create a user uracoli
- create a working directory /home/uracoli/work
The "CMD" statement at the end of the file is executed at every start of the container. It issues a message and starts bash.
First Run of the Container
After successfully creating the container, run the command
docker run -t -i my-uracoli-env
in a terminal
$ docker run -t -i u5idev == starting uracoli-development environment == uracoli@6f065accfc17:~$
On this shell prompt type pwd to see that you are in the directory /home/uracoli/work.
Your first development session might start with the following commands:
uracoli@9311c77b2d54:~/work/uracoli$ hg clone http://hg.savannah.nongnu.org/hgweb/uracoli/ destination directory: uracoli ... uracoli@9311c77b2d54:~/work/uracoli$ cd uracoli uracoli@9311c77b2d54:~/work/uracoli$ scons radiofaro scons: Reading SConscript files ... build 1 of 104 boards ...
Adding some Comfort
After ending (Ctrl-D) and restarting the docker session, you will notice that the docker container is suffered from amnesia. That means, after the next restart the directory /home/uracoli/work is empty. Also editing source code with terminal tools like "nano" or "vi" might not fit your regular development habits. To circumvent this, we simply map a local directory from the host computer into the docker container. So you can edit the files from the host machine with your favourite IDE or source-code editor. Mapping a local directory to docker is done by passing the -v option to the run command.docker run -v /home/axel/Work/uracoli-aw:/home/uracoli/work -it my-uracoli-env
Now you can edit the files on the host compile and compile it in the docker container.
Mapping Serial Devices into Docker
On Ubuntu it is possible to map serial devices into the docker container with the following command:$ docker run --device=/dev/ttyUSB0 -v .... -it my-uracoli-env
System Clean Up
While experimenting with docker, a lot of logfiles from different sessions and temporary images may waste a enormous amount of disk space. To get rid of this left overs, you can use the follwing commands on Linux/Ubuntu to clean the system$ docker rm $(docker ps -aq) $ docker rmi $(docker images -f "dangling=true" -q)
The blog was absolutely fantastic! Lot of information is helpful in some or the other way. Keep updating the blog, looking forward for more content...Great job, keep it up.
AntwortenLöschensoftware development
Hi your blog is very really impressive and informative i learnt alot from your article.it is useful for all who wants to know about
AntwortenLöschenembedded software development services
Thanks for helping me to understand basic concepts. As a beginner in DevOps, your post helps me a lot.
AntwortenLöschenbest devops training in chennai | DevOps training in Chennai omr | DevOps training in Chennai with placement
Nice Blog...
AntwortenLöschenThanks for Sharing...
AVR Training, Embedded Systems Training, Embedded Systems Training Institute in Noida
Thank you.Well it was nice post and very helpful information on Azure Online Training
AntwortenLöschenNice blog Content.It is very informative and helpful. Please share more content. Thanks.
AntwortenLöschenMicrocontroller Training in Delhi
An interesting and interesting article. Thanks for sharing
AntwortenLöschenlều xông hơi mini
mua lều xông hơi ở đâu
lều xông hơi gia đình
bán lều xông hơi
xông hơi hồng ngoại
ok
AntwortenLöschencửa lưới chống muỗi
cửa lưới chống muỗi Hà Nội
This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to article very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
AntwortenLöschenDedicatedHosting4u.com
Thank you for sharing this great post, I am very impressed with your post, the information provided is meticulous and easy to understand. I will regularly follow your next post.
AntwortenLöschenThanks
Cpa offers
This is a fantastic idea! I like it a lot because it's super easy for the audience to see the value of opting in. wonderful and amazing post very use full your post thanks for sharing your article
AntwortenLöschenAndroid Application development
Web application
Your post is very good. I got to learn a lot from your post. Thank you for sharing your article for us. it is amazing post
AntwortenLöschenwhat is seo
types of seo
Thanks for sharing such a good blog. You’re doing a great job. Keep posting like this useful info !!
AntwortenLöschenBest Ethical Hacking Training in Chennai | Best Ethical Hacking Course in Chennai | Ethical Hacking Training with Placement | ceh Training in Chennai at TwinTech Solutions | Ethical Hacking Course | ceh Training | Ethical Hacking Training