Wednesday, August 1, 2018

other ubuntu version in docker

(as root)
docker run -ti ubuntu:latest /bin/bash
(-ti is interactive)
apt-get and do your stuff.
any change is deleted on exit. 
To save the changes 
get the container id by
docker container ls

then
docker commit <container id> name

to change the startup command you can create a Dockerfile reading

# Use an official Python runtime as a parent image
FROM cubuntu

# Set the working directory to /app
WORKDIR /home/fabio

# Copy the current directory contents into the container at /app
COPY startup.sh /

ENTRYPOINT ["/startup.sh"]

where startup.sh is a script in the same file of the Dockerfile
To mount filesystems of the host (e.g. to use X.In this case,create the user)
docker run --hostname beaver -ti -v /tmp/.X11-unix:/tmp/.X11-unix -v /home/fabio:/home/fabio beaver


sources:
http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/
https://www.techrepublic.com/article/how-to-commit-changes-to-a-docker-image/
https://forums.docker.com/t/is-it-possible-to-pass-arguments-in-dockerfile/14488/3
https://docs.docker.com/storage/bind-mounts/#choosing-the--v-or---mount-flag
https://stackoverflow.com/questions/43031100/when-to-use-hostname-in-docker


No comments:

Post a Comment