Docker Community Forums

Share and learn in the Docker community.

Docker for embedded device with NFS server

docker
build

(Cdonate) #1

So, a brief explanation of what I’m trying to accomplish.

At the company I work, we develop a product using a specific kernel from Realtek. To compile this kernel we need a very specific version of Ubuntu, with very specific libs installed.

And because of that we are locked using an old version of Ubuntu on all notebooks.

So, I decided to create a Docker container to compile the kernel. This way we would be free to upgrade our machines to the linux flavor of our choice.

The Docker container is a very basic Ubuntu 14.04 installation with all the necessary libs added. The compilation part is working perfectly, this part is done.

The issue I’m having is that we can develop on our platform using NFS, after the compile is done the rootfs is copied to the NFS root to be accessed from our product.
What I would like to do is:

  • Add a NFS server to my Docker container
  • Route IP:PORT from my PC to the NFS IP:PORT of my container so it can serve the rootfs to the product.

I really need some help on these two items.

Any and all assistance is very much appreciated.

I access the Container with the following command:

sudo docker run -it --mount type=bind,source="$(pwd)",target=/usr/src/app sandbox:latest /bin/bash

Here is my Dockerfile:

#the first thing we need to do is define from what image we want to build from.
#Here we will use a 14.04 LTS(long term support) version of ubuntu from docker Hub :
FROM ubuntu:14.04

MAINTAINER Claudio Donaté "claudio.donate at gmail"

ARG DEBIAN_FRONTEND=noninteractive

RUN mv /etc/apt/sources.list /etc/apt/sources.list.old
RUN echo 'deb mirror://mirrors.ubuntu.com/mirrors.txt trusty main restricted universe multiverse' >> /etc/apt/sources.list
RUN echo 'deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main restricted universe multiverse' >> /etc/apt/sources.list
RUN echo 'deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-backports main restricted universe multiverse' >> /etc/apt/sources.list
RUN echo 'deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main restricted universe multiverse' >> /etc/apt/sources.list
RUN dpkg --add-architecture i386

RUN apt-get update -q

#install software requirements
RUN apt-get install --no-install-recommends -y software-properties-common \
cpp-4.8 \
gcc-4.8 \
git \
symlinks \
bash-completion \
nano \
vim

# Install build dependancies
RUN apt-get install --no-install-recommends -y \
build-essential \
zlib1g-dev \
flex \
bison \
libncurses5-dev \
zlib1g-dev:i386 \
libc6:i386 \
libncurses5:i386 \
libstdc++6:i386 \
zlib1g:i386

#install make dependancies
RUN apt-get install --no-install-recommends -y \
libtool \
make \
automake \
pkg-config

#create path for xterm
RUN mkdir -p /usr/share/terminfo/x/
RUN cp -R /lib/terminfo/x/* /usr/share/terminfo/x/
RUN touch /etc/exports


#create a directory for our project & setup a shared workfolder between the host and docker container
RUN mkdir -p /usr/src/app
VOLUME ["/usr/src/app"]
WORKDIR /usr/src/app
RUN cd /usr/src/app

EXPOSE 80