Skip to content

docker build gives an error — ERROR [4/7] COPY dist/codex.tgz codex.tgz` #22

Closed

Description

@bessarabov

I would like to run it it docker on my macbook.

I've found the Dockerfile:

bessarabov@m3:~/git/codex$ find .|grep Dockerfile
./codex-cli/Dockerfile
bessarabov@m3:~/git/codex$

But the build id failing:

bessarabov@m3:~/git/codex$ cd codex-cli/
bessarabov@m3:~/git/codex/codex-cli$ docker build --tag codex .
[+] Building 2.7s (8/11)                                                                                  docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                      0.0s
 => => transferring dockerfile: 1.05kB                                                                                    0.0s
 => [internal] load metadata for docker.io/library/node:20                                                                2.6s
 => [internal] load .dockerignore                                                                                         0.0s
 => => transferring context: 2B                                                                                           0.0s
 => CANCELED [1/7] FROM docker.io/library/node:20@sha256:a5fb035ac1dff34a4ecaea85f90f7321185695d3fd22c12ba12f4535a4647cc  0.0s
 => => resolve docker.io/library/node:20@sha256:a5fb035ac1dff34a4ecaea85f90f7321185695d3fd22c12ba12f4535a4647cc5          0.0s
 => [internal] load build context                                                                                         0.0s
 => => transferring context: 147B                                                                                         0.0s
 => CACHED [2/7] RUN apt update && apt install -y less   git   procps   sudo   fzf   zsh   man-db   unzip   gnupg2   gh   0.0s
 => CACHED [3/7] RUN mkdir -p /usr/local/share/npm-global &&   chown -R node:node /usr/local/share                        0.0s
 => ERROR [4/7] COPY dist/codex.tgz codex.tgz                                                                             0.0s
------
 > [4/7] COPY dist/codex.tgz codex.tgz:
------
Dockerfile:38
--------------------
  36 |
  37 |     # Install codex
  38 | >>> COPY dist/codex.tgz codex.tgz
  39 |     RUN npm install -g codex.tgz
  40 |
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref zt5e0ajire9p9cfs724xkjpjq::tiim52o0dd0z9p0ydt1kupi3d: "/dist/codex.tgz": not found
bessarabov@m3:~/git/codex/codex-cli$

I have also found script codex-cli/scripts/build_container.sh, but running it also produce the error:

bessarabov@m3:~/git/codex$ cat codex-cli/scripts/build_container.sh
#!/bin/bash

docker build -t codex -f codex-cli/Dockerfile codex-cli
bessarabov@m3:~/git/codex$ sh codex-cli/scripts/build_container.sh
[+] Building 2.3s (8/11)                                                                                                                                                                      docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                                                          0.0s
 => => transferring dockerfile: 1.05kB                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/node:20                                                                                                                                                    2.3s
 => [internal] load .dockerignore                                                                                                                                                                             0.0s
 => => transferring context: 2B                                                                                                                                                                               0.0s
 => CANCELED [1/7] FROM docker.io/library/node:20@sha256:a5fb035ac1dff34a4ecaea85f90f7321185695d3fd22c12ba12f4535a4647cc5                                                                                     0.0s
 => => resolve docker.io/library/node:20@sha256:a5fb035ac1dff34a4ecaea85f90f7321185695d3fd22c12ba12f4535a4647cc5                                                                                              0.0s
 => [internal] load build context                                                                                                                                                                             0.0s
 => => transferring context: 147B                                                                                                                                                                             0.0s
 => CACHED [2/7] RUN apt update && apt install -y less   git   procps   sudo   fzf   zsh   man-db   unzip   gnupg2   gh   iptables   ipset   iproute2   dnsutils   aggregate   jq                             0.0s
 => CACHED [3/7] RUN mkdir -p /usr/local/share/npm-global &&   chown -R node:node /usr/local/share                                                                                                            0.0s
 => ERROR [4/7] COPY dist/codex.tgz codex.tgz                                                                                                                                                                 0.0s
------
 > [4/7] COPY dist/codex.tgz codex.tgz:
------
Dockerfile:38
--------------------
  36 |
  37 |     # Install codex
  38 | >>> COPY dist/codex.tgz codex.tgz
  39 |     RUN npm install -g codex.tgz
  40 |
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref zt5e0ajire9p9cfs724xkjpjq::5hstc1upqe8328lnksrvtqfcd: "/dist/codex.tgz": not found
bessarabov@m3:~/git/codex$

I was expecting to be able to build docker just with docker build command, but it looks like the system is expecting to have tgz file build on the host machine.

Activity

  1. kykosic commented on Apr 16, 2025

    @kykosic

    Thanks for reporting, looking into this!

  2. self-assigned this
    on Apr 16, 2025
  3. bessarabov commented on Apr 16, 2025

    @bessarabov
    Author

    I changed the Dockerfile to the most simple:

    bessarabov@m3:~/git/codex$ cat codex-cli/Dockerfile
    FROM node:20
    
    RUN npm i -g @openai/codex
    bessarabov@m3:~/git/codex$
    

    And this looks like it is working. But quite probably you had some ideas behind the existing Dockerfile.

  4. bessarabov commented on Apr 16, 2025

    @bessarabov
    Author

    Thank you! Confirming that the updated code works.

    This command successfully build image:

    bessarabov@m3:~/git/codex$ sh codex-cli/scripts/build_container.sh
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions