Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

730
Vistas
Docker container not able to locate Zip packages?

All Ubuntu wiley repositories are added to my Dockerfile, namely main, universe, etc. and are present in my docker image. However, apt-get install in the following Dockerfile is not able to locate any ZIP/UnZIP packages. Error log in the end.

How can I install these common zip packages? At least p7zip-full and rar.

Dockerfile

FROM ubuntu:15.10
CMD ["bash"]
RUN add-apt-repository main && \
    add-apt-repository universe && \
    add-apt-repository restricted && \
    add-apt-repository multiverse
RUN  apt-get update -y && \
     apt-get upgrade -y && \
     apt-get dist-upgrade -y && \
     apt-get -y autoremove && \
     apt-get clean
RUN apt-get install p7zip \
    p7zip-full \
    p7zip-rar \
    unace \
    unrar \
    zip \
    unzip \
    xz-utils \
    sharutils \
    rar \
    uudeview \
    mpack \
    arj \
    cabextract \
    file-roller \
    && rm -rf /var/lib/apt/lists/*

ERROR THROWN

E: Unable to locate package p7zip-full
E: Unable to locate package unace
E: Unable to locate package unrar
E: Unable to locate package zip
E: Unable to locate package unzip
E: Unable to locate package sharutils
E: Unable to locate package rar
E: Unable to locate package uudeview
E: Unable to locate package mpack
E: Unable to locate package arj
E: Unable to locate package cabextract
E: Unable to locate package file-roller
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Tried with this Dockerfile (your Dockerfile without what I told you in my previous comment):

FROM ubuntu:15.10
RUN  apt-get update -y && \
     apt-get upgrade -y && \
     apt-get dist-upgrade -y && \
     apt-get -y autoremove && \
     apt-get clean
RUN apt-get install -y p7zip \
    p7zip-full \
    unace \
    zip \
    unzip \
    xz-utils \
    sharutils \
    uudeview \
    mpack \
    arj \
    cabextract \
    file-roller \
    && rm -rf /var/lib/apt/lists/*

CMD ["bash"]

It works and it installs zip and p7zip

$ docker build -t mytest .
$ docker run -d -ti --name mytest mytest /bin/bash
$ docker exec -ti mytest /bin/bash

 root@f01fc3456a2a:/# zip 
 root@f01fc3456a2a:/# p7zip
over 4 years ago · Santiago Trujillo Denunciar

0

According to Docker best practices

@gile's answer could be improved by:

  • using apt-get update and install in a single layer
  • avoiding apt-get upgrade

https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#leverage-build-cache

Docker sees the initial and modified instructions as identical and reuses the cache from previous steps. As a result the apt-get update is not executed because the build uses the cached version. Because the apt-get update is not run, your build can potentially get an outdated version of the curl and nginx packages.

Using RUN apt-get update && apt-get install -y ensures your Dockerfile installs the latest package versions with no further coding or manual intervention. This technique is known as “cache busting”. You can also achieve cache-busting by specifying a package version. This is known as version pinning

Avoid RUN apt-get upgrade and dist-upgrade, as many of the “essential” packages from the parent images cannot upgrade inside an unprivileged container. If a package contained in the parent image is out-of-date, contact its maintainers. If you know there is a particular package, foo, that needs to be updated, use apt-get install -y foo to update automatically.

This should be the same as @gile's answer with those best practices applied

FROM ubuntu:15.10
RUN  apt-get -y update \
     && apt-get -y autoremove \
     && apt-get clean \
     && apt-get install -y p7zip \
     p7zip-full \
     unace \
     zip \
     unzip \
     xz-utils \
     sharutils \
     uudeview \
     mpack \
     arj \
     cabextract \
     file-roller \
     && rm -rf /var/lib/apt/lists/*

CMD ["bash"]

*edit

The Docker best practices documentation has been re-arranged.

The advice remains the same. While the part of documentation that the above link anchors to now merely alludes to concerns between build cache and apt-get...

They have added a new section of documentation dedicated to this topic.

https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#apt-get

in short:

Always combine RUN apt-get update with apt-get install in the same RUN statement

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda