I'm new to Docker, and I'm trying to build an image with firefox 56. I was wondering what is the best way to do this.
As far as I know, there are two ways. One is to create a Dockerfile, another is opening a shell into an existing image, modify it by hand, and commit changes (docker commit).
It seems to me that the best way is using a Dockerfile, but everytime I do an error the commands installed in the Dockerfile re-download and re-install the wget and gtk packages and this is a long process. Is there a method to cache also what I've already downloaded during the build process?
The Dockerfile I'm currently using is the following, although it isn't fully relevant (in the current version the commands seem ok).
FROM ubuntu:14.04
RUN apt-get update && apt-get install -y wget gtk3.0
# Replace 1000 with your user / group id
RUN export uid=1000 gid=1000 && \
mkdir -p /home/developer && \
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 && \
cd /tmp && wget http://ftp.mozilla.org/pub/firefox/releases/56.0/linux-x86_64/en-US/firefox-56.0.tar.bz2 && tar -xjf firefox-56.0.tar.bz2 && mv firefox /opt
USER developer
ENV HOME /home/developer
CMD /opt/firefox/firefox