containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.8k stars 2.42k forks source link

Podman build fails to build containerfile but same instructions work from within a container #21301

Closed ucfchandra closed 9 months ago

ucfchandra commented 10 months ago

Issue Description

When python:3.11-bookworm is pulled and run, I can go in and enter the following commands:

apt-get clean && \ apt-get update -y && \ apt-get upgrade -y && \ apt-get install -f libldap-dev \ libsasl2-dev \ build-essential \ npm -y

However, when I make a container file that says RUN the command above, I get hash sum mismatches and the apt-get fails.

Steps to reproduce the issue

Steps to reproduce the issue

  1. podman run -ti python:3.11-bookworm bash
  2. apt-get clean && \ apt-get update -y && \ apt-get upgrade -y && \ apt-get install -f libldap-dev \ libsasl2-dev \ build-essential \ npm -y
  3. You should see the commands pass
  4. Now write a containerfile with

FROM python:3.11-bookworm ENTRYPOINT ["/bin/bash"]

WORKDIR /home

RUN apt-get clean && \ apt-get update -y && \ apt-get upgrade -y && \ apt-get install -f libldap-dev \ libsasl2-dev \ build-essential \ npm -y

  1. It fails for me

Describe the results you received

E: unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

When tried with both, I get Hash Sum mismatches and an error building at the RUN step with exit status 100

Describe the results you expected

My container to work T.T

podman info output

host:
  arch: amd64
  buildahVersion: 1.33.2
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.8-2.fc39.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.8, commit: '
  cpuUtilization:
    idlePercent: 99.27
    systemPercent: 0.48
    userPercent: 0.26
  cpus: 4
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: coreos
    version: "39"
  eventLogger: journald
  freeLocks: 2039
  hostname: localhost.localdomain
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 1000000
    uidmap:
    - container_id: 0
      host_id: 2092899380
      size: 1
    - container_id: 1
      host_id: 100000
      size: 1000000
  kernel: 6.6.8-200.fc39.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 531697664
  memTotal: 2059898880
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.9.0-1.fc39.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.9.0
    package: netavark-1.9.0-1.fc39.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.9.0
  ociRuntime:
    name: crun
    package: crun-1.12-1.fc39.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.12
      commit: ce429cb2e277d001c2179df1ac66a470f00802ae
      rundir: /run/user/2092899380/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-0^20231204.gb86afe3-1.fc39.x86_64
    version: |
      pasta 0^20231204.gb86afe3-1.fc39.x86_64
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: true
    path: /run/user/2092899380/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.2-1.fc39.x86_64
    version: |-
      slirp4netns version 1.2.2
      commit: 0ee2d87523e906518d34a6b423271e4826f71faf
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 5h 1m 39.00s (Approximately 0.21 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /var/home/core/.config/containers/storage.conf
  containerStore:
    number: 9
    paused: 0
    running: 1
    stopped: 8
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /var/home/core/.local/share/containers/storage
  graphRootAllocated: 106769133568
  graphRootUsed: 7403663360
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 100
  runRoot: /run/user/2092899380/containers
  transientStore: false
  volumePath: /var/home/core/.local/share/containers/storage/volumes
version:
  APIVersion: 4.8.2
  Built: 1702300984
  BuiltTime: Mon Dec 11 08:23:04 2023
  GitCommit: ""
  GoVersion: go1.21.4
  Os: linux
  OsArch: linux/amd64
  Version: 4.8.2

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

Mac

Additional information

N/A

flouthoc commented 10 months ago

Hi,

Containerfile in description looks incorrect to me there is an error on second line of RUN, could you please try below containerfile and check if it works.

FROM python:3.11-bookworm
ENTRYPOINT ["/bin/bash"]

WORKDIR /home

RUN apt-get clean && \
apt-get update -y && \
apt-get upgrade -y && \
apt-get install -f libldap-dev libsasl2-dev build-essential npm -y
sanmai-NL commented 9 months ago

@ucfchandra Can this be closed?

ucfchandra commented 9 months ago

@sanmai-NL Yes, I solved it by getting a more up to date python image