10

I am trying to reduce the footprint of my Ubuntu docker image. Given that there is very little use for the man files and I deleted them, committed the image and then tried to use it. AFAICT it did no harm. However, I thought it worth asking here. Am I storing up any ugly problems for the future by doing this?

17

Short answer: no, this should not cause any major issue.


TL;DR

I think that you will not cause any major damage except these two cases:

  1. If do you need a manual for any command, you won't find it.
  2. The /usr/share/man folder will grow when you do a package install/update.

  1. Disable the apt cache:

    When you install a package with apt-get or aptitude on a Debian-based system, the downloaded package is, by default, kept in the APT cache located at /var/cache/apt/archives. This is really not necessary as you typically do not re-install the same package ever again. Over time, the content in /var/cache/apt/archives will grow.

    • Create a file in /etc/apt/apt.conf.d/ called 02nocache with these contents:

      Dir::Cache "";
      Dir::Cache::archives "";
      
    • Clear the apt cache:

      sudo rm -rf /var/cache/apt/archives 
      
  2. Disable man pages, locales and docs:

    You can disable a lot of rubbish doing this:

    • Create a file called 01_nodoc on /etc/dpkg/dpkg.cfg.d with these contents:

      # /etc/dpkg/dpkg.cfg.d/01_nodoc
      
      # Delete locales
      path-exclude=/usr/share/locale/*
      
      # Delete man pages
      path-exclude=/usr/share/man/*
      
      # Delete docs
      path-exclude=/usr/share/doc/*
      path-include=/usr/share/doc/*/copyright
      
    • Delete the current contents:

      sudo rm -rf /usr/share/doc/
      sudo rm -rf /usr/share/man/
      sudo rm -rf /usr/share/locale/
      
| improve this answer | |
  • 1
    That should actually be `/etc/dpkg/dpkg.cfg.d' – DroidOS May 26 '15 at 13:36
  • I've edited the dpkg.cfg.d, sorry it was a typo. You asked for water and I served you... water. You're welcome! – 0x2b3bfa0 May 26 '15 at 13:39
  • Hi, please fix the dpkg.conf.d inside the first commented line too. I tried to do it myself, but the site complains about the edit being too small. I accidentally copied the path from the commented line instead of from the line above it. – ateijelo Jan 23 '17 at 19:20
  • @ateijelo: Done! – 0x2b3bfa0 Jan 24 '17 at 12:18
3

Logically there would be no harm for your system, but you still may loose when you need some man pages.

Also you should notice any update will create that directory again

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.