Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

738
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda