From 0419f3399d4aa9cfd0341521d9cfd02384de471b Mon Sep 17 00:00:00 2001 From: takasehideki Date: Mon, 8 Apr 2024 11:14:40 +0900 Subject: [PATCH] move `RUN rm docker-clean` command to diet image size This commit can reduce the size of docker images (7.28 GB to 6.33 GB for humble) while keeping apt-get completion feature by moving `RUN rm /etc/apt/apt.conf.d/docker-clean` to the later stage of Dockerfile. We can close https://github.com/Tiryoh/docker-ros2-desktop-vnc/issues/152 when this commit will be merged as PR. relate: https://github.com/Tiryoh/docker-ros2-desktop-vnc/issues/152#issuecomment-2041350516 https://askubuntu.com/questions/86375/apt-get-autocompletion-of-package-name-is-broken --- foxy/Dockerfile | 6 +++--- humble/Dockerfile | 6 +++--- iron/Dockerfile | 6 +++--- rolling/Dockerfile | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/foxy/Dockerfile b/foxy/Dockerfile index a621978..a2b948a 100644 --- a/foxy/Dockerfile +++ b/foxy/Dockerfile @@ -60,9 +60,6 @@ RUN sed -i "s/UI.initSetting('resize', 'off');/UI.initSetting('resize', 'remote' RUN sed -i 's/Prompt=.*/Prompt=never/' /etc/update-manager/release-upgrades RUN sed -i 's/enabled=1/enabled=0/g' /etc/default/apport -# Enable apt-get completion -RUN rm /etc/apt/apt.conf.d/docker-clean - # Install Firefox RUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:mozillateam/ppa -y && \ echo 'Package: *' > /etc/apt/preferences.d/mozilla-firefox && \ @@ -111,6 +108,9 @@ RUN apt-get update -q && \ ros-${ROS_DISTRO}-ros-ign-gazebo && \ rm -rf /var/lib/apt/lists/* +# Enable apt-get completion after running `apt-get update` in the container +RUN rm /etc/apt/apt.conf.d/docker-clean + COPY ./entrypoint.sh / ENTRYPOINT [ "/bin/bash", "-c", "/entrypoint.sh" ] diff --git a/humble/Dockerfile b/humble/Dockerfile index 252bcaa..1a84e10 100644 --- a/humble/Dockerfile +++ b/humble/Dockerfile @@ -61,9 +61,6 @@ RUN sed -i "s/UI.initSetting('resize', 'off');/UI.initSetting('resize', 'remote' RUN sed -i 's/Prompt=.*/Prompt=never/' /etc/update-manager/release-upgrades RUN sed -i 's/enabled=1/enabled=0/g' /etc/default/apport -# Enable apt-get completion -RUN rm /etc/apt/apt.conf.d/docker-clean - # Install Firefox RUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:mozillateam/ppa -y && \ echo 'Package: *' > /etc/apt/preferences.d/mozilla-firefox && \ @@ -117,6 +114,9 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ rm -rf /var/lib/apt/lists/*; \ fi +# Enable apt-get completion after running `apt-get update` in the container +RUN rm /etc/apt/apt.conf.d/docker-clean + COPY ./entrypoint.sh / RUN dos2unix /entrypoint.sh ENTRYPOINT [ "/bin/bash", "-c", "/entrypoint.sh" ] diff --git a/iron/Dockerfile b/iron/Dockerfile index a3b98ab..1597291 100644 --- a/iron/Dockerfile +++ b/iron/Dockerfile @@ -61,9 +61,6 @@ RUN sed -i "s/UI.initSetting('resize', 'off');/UI.initSetting('resize', 'remote' RUN sed -i 's/Prompt=.*/Prompt=never/' /etc/update-manager/release-upgrades RUN sed -i 's/enabled=1/enabled=0/g' /etc/default/apport -# Enable apt-get completion -RUN rm /etc/apt/apt.conf.d/docker-clean - # Install Firefox RUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:mozillateam/ppa -y && \ echo 'Package: *' > /etc/apt/preferences.d/mozilla-firefox && \ @@ -117,6 +114,9 @@ RUN rosdep update # rm -rf /var/lib/apt/lists/*; \ # fi +# Enable apt-get completion after running `apt-get update` in the container +RUN rm /etc/apt/apt.conf.d/docker-clean + COPY ./entrypoint.sh / ENTRYPOINT [ "/bin/bash", "-c", "/entrypoint.sh" ] diff --git a/rolling/Dockerfile b/rolling/Dockerfile index fad95e1..a02bc06 100644 --- a/rolling/Dockerfile +++ b/rolling/Dockerfile @@ -61,9 +61,6 @@ RUN sed -i "s/UI.initSetting('resize', 'off');/UI.initSetting('resize', 'remote' RUN sed -i 's/Prompt=.*/Prompt=never/' /etc/update-manager/release-upgrades RUN sed -i 's/enabled=1/enabled=0/g' /etc/default/apport -# Enable apt-get completion -RUN rm /etc/apt/apt.conf.d/docker-clean - # Install Firefox RUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:mozillateam/ppa -y && \ echo 'Package: *' > /etc/apt/preferences.d/mozilla-firefox && \ @@ -117,6 +114,9 @@ RUN rosdep update # rm -rf /var/lib/apt/lists/*; \ # fi +# Enable apt-get completion after running `apt-get update` in the container +RUN rm /etc/apt/apt.conf.d/docker-clean + COPY ./entrypoint.sh / ENTRYPOINT [ "/bin/bash", "-c", "/entrypoint.sh" ]