Here is only a partial answer. The limitation is that it does not include the part to flash the OS, drivers, and file system.
After the basic OS and file system have been flashed and installed to the target TX2 module, the TX2 can be accessed through a network port over ssh. Thus the Ubuntu host only needs to: Get a GUI with sudo ability, and access network. By default, a docker container has the ability to connect to the network that the host can connect to. To get a GUI, there are a few approaches. Below is the X-over-ssh approach with help from two scripts. The script includes operations to add the current user to the sudo group too.
Run the first script to create a Ubuntu docker image customized for running the JetPack 3.1 installer. Then run the second script to create a docker container with static user name and password, and mounted host user account home to the container guest user home.
The first script to create a docker image:
# current uid and gid
curr_uid=`id -u`
curr_gid=`id -g`
# create bb.dockerfile:
cat << EOF2 > bb.dockerfile
FROM ubuntu:xenial-20180417
ARG UNAME=testuser
ARG UID=1000
ARG GID=1000
RUN groupadd -g \$GID \$UNAME
RUN useradd -m -u \$UID -g \$GID -s /bin/bash \$UNAME
RUN apt-get update
RUN apt-get install -y openssh-server openssh-client iputils-ping sudo
RUN apt-get install -y lsb-release libgtk2.0 xterm vim rsync sshpass
RUN mkdir /var/run/sshd
RUN echo 'testuser:screencast' | chpasswd
RUN sed -i -e '/sudo/ s/$/testuser/' /etc/group
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
EOF2
docker build --build-arg UID=${curr_uid} --build-arg GID=${curr_gid} \
-f bb.dockerfile -t testimg .
The last CMD
usually can be replaced by these two if not running a sshd
service:
USER \$UNAME
CMD /bin/bash
The second script to create the container:
docker run -it -d \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME:/home/testuser \
-p 2022:22 \
--name testcontainer -P testimg
To access the container guest Ubuntu, run on the host using password screencast
:
ssh -l testuser -p 2022 -X localhost