Snippets

Dekko Project Dockerfile to run Ubuntu-Sdk from container image

Created by Daniel Chapman last modified
FROM ubuntu:15.04

MAINTAINER dpniel@ubuntu.com

RUN locale-gen en_US en_US.UTF-8 en_GB en_GB.UTF-8 && \
	dpkg-reconfigure locales

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q software-properties-common
RUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ubuntu-sdk-team/ppa -y

RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
    apt-get install --no-install-recommends -y \
    g++ \
    pkg-config \
    ubuntu-sdk \
    libconnectivity-qt1-dev \
    qml-module-qtcontacts \
    qtpim5-dev \
	libnih-dbus-dev \
	libdbus-1-dev \
	libghc-gio-dev \
	qtpim5-dev \
    qttools5-dev-tools \
    libaccounts-qt5-dev \
    libgsettings-qt-dev \
    qtdeclarative5-private-dev \
    qtscript5-private-dev \
    qml-module-qtquick-privatewidgets \
    qtbase5-private-dev \
    qtbase5-dev \
    qtbase5-dbg \
    qtbase5-dev-tools-dbg \
    qtbase5-dbg \
    qtbase5-dev-tools \
    intltool \
    bzr \
	&& \
	apt-get clean

RUN export uid=1000 gid=1000 && \
    mkdir -p /home/developer && \
	ls /etc/ && \
	mkdir /etc/sudoers.d/ && \
    echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \
    echo "developer:x:${uid}:" >> /etc/group && \
    echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
    chmod 0440 /etc/sudoers.d/developer && \
    chown ${uid}:${gid} -R /home/developer
	
USER developer
ENV HOME /home/developer
CMD /usr/bin/ubuntu-sdk

Comments (2)

  1. Daniel Chapman

    To build the image do something like

    $ docker build -t dekko-sdk .
    

    Then you need to bind the docker DISPLAY to the host and allow the container to use the host network and xserver, also binding the host home directory to the container to access project files

    $ sudo docker run -e DISPLAY -e OXIDE_DISABLE_SETUID_SANDBOX=1 -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME/.Xauthority:/home/developer/.Xauthority --net=host -v $HOME:$HOME --rm dekko-sdk
    

    If for some reason the forwarding of X isn't working check uid and gid of host match the container, if not either rebuild or run "xhost +" before docker run command

  2. Guilhem Bonnefille

    Nice! Exactly what I'm looking for.

    I would suggest to create the developper user AFTER installing software: doing this would allow people to change their mind on own to create the user, without rebuilding the whole container.

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.