Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

push to docker-archive, cannot start in docker #5489

Open
baryluk opened this issue Apr 24, 2024 · 5 comments
Open

push to docker-archive, cannot start in docker #5489

baryluk opened this issue Apr 24, 2024 · 5 comments

Comments

@baryluk
Copy link

baryluk commented Apr 24, 2024

I might be doing something wrong, but lets go:

Debian testing, amd64

user@debian:~$ buildah version
Version:         1.33.7
Go Version:      go1.22.1
Image Spec:      1.1.0-rc.5
Runtime Spec:    1.1.0
CNI Spec:        1.0.0
libcni Version:  
image Version:   5.29.2
Git Commit:      
Built:           Thu Jan  1 00:00:00 1970
OS/Arch:         linux/amd64
BuildPlatform:   linux/amd64
user@debian:~$ docker version
Client:
 Version:           20.10.25+dfsg1
 API version:       1.41
 Go version:        go1.21.5
 Git commit:        b82b9f3
 Built:             Mon Jan  8 00:09:17 2024
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.25+dfsg1
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.21.5
  Git commit:       5df983c
  Built:            Mon Jan  8 00:09:17 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.24~ds1
  GitCommit:        1.6.24~ds1-1
 runc:
  Version:          1.1.12+ds1
  GitCommit:        1.1.12+ds1-1
 docker-init:
  Version:          0.19.0
  GitCommit:        
user@debian:~$ 
user@debian:~/bah$ git clone https://github.com/docker/getting-started-app.git
...
user@debian:~/bah/getting-started-app$ cd getting-started-app

# add Dockerfile from example https://docs.docker.com/get-started/02_our_app/#build-the-apps-image
user@debian:~/bah/getting-started-app$ cat Dockerfile
cat Dockerfile 
# syntax=docker/dockerfile:1

FROM node:18-alpine
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]
EXPOSE 3000

user@debian:~/bah/getting-started-app$ 
user@debian:~/bah/getting-started-app$ buildah build --format docker --squash .
STEP 1/6: FROM node:18-alpine
STEP 2/6: WORKDIR /app
STEP 3/6: COPY . .
STEP 4/6: RUN yarn install --production
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 8.21s.
STEP 5/6: CMD ["node", "src/index.js"]
STEP 6/6: EXPOSE 3000
COMMIT
Getting image source signatures
Copying blob a9b5c91e135f done   | 
Copying config 7e6deb616b done   | 
Writing manifest to image destination
--> 7e6deb616bab
7e6deb616bab61297dfbbb728e541dff396d5475a98cc60fef4d27040007a238
user@debian:~/bah/getting-started-app$ 

user@debian:~/bah/getting-started-app$ buildah push --format docker 7e6deb616bab61297dfbbb728e541dff396d5475a98cc60fef4d27040007a238 docker-archive:/tmp/docker-dockerfile-example-master.tar:localhost/my-image:latest
Getting image source signatures
Copying blob a9b5c91e135f done   | 
Copying config 7e6deb616b done   | 
Writing manifest to image destination
user@debian:~/bah/getting-started-app$ 

user@debian:~/bah/getting-started-app$ docker import /tmp/docker-dockerfile-example-master.tar 
sha256:8ec1536557eab39fe2546bb3ef08a609cc2412c0b881c1ede3958f227f99c35e
user@debian:~/bah/getting-started-app$ 

user@debian:~/bah/getting-started-app$ docker image ls | grep 8ec
<none>       <none>    8ec1536557ea   16 seconds ago   229MB
user@debian:~/bah/getting-started-app$ 

user@debian:~/bah/getting-started-app$ docker inspect 8ec1536557ea
[
    {
        "Id": "sha256:8ec1536557eab39fe2546bb3ef08a609cc2412c0b881c1ede3958f227f99c35e",
        "RepoTags": [],
        "RepoDigests": [],
        "Parent": "",
        "Comment": "Imported from -",
        "Created": "2024-04-24T22:47:21.850333549Z",
        "Container": "",
        "ContainerConfig": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "DockerVersion": "20.10.25+dfsg1",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 228854039,
        "VirtualSize": 228854039,
        "GraphDriver": {
            "Data": {
                "MergedDir": "/var/lib/docker/fuse-overlayfs/171342d312981d63eef99ad0dae95d1626d7c7dab3f6de7a7098eddeb19de885/merged",
                "UpperDir": "/var/lib/docker/fuse-overlayfs/171342d312981d63eef99ad0dae95d1626d7c7dab3f6de7a7098eddeb19de885/diff",
                "WorkDir": "/var/lib/docker/fuse-overlayfs/171342d312981d63eef99ad0dae95d1626d7c7dab3f6de7a7098eddeb19de885/work"
            },
            "Name": "fuse-overlayfs"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:36c4c205440adca276bab9b012ef3db7e8a94b54418776a4fe9843516e6f355e"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]
user@debian:~/bah/getting-started-app$ 

Lets try to run it:

user@debian:~/bah/getting-started-app$ docker run --rm -it 8ec1536557ea
docker: Error response from daemon: No command specified.
See 'docker run --help'.
user@debian:~/bah/getting-started-app$ docker run --rm -it 8ec1536557ea /bin/sh
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown.
user@debian:~/bah/getting-started-app$ 

The container "works" fine in buildah:

user@debian:~/bah/getting-started-app$ buildah from --name=foobar 7e6deb616bab61297dfbbb728e541dff396d5475a98cc60fef4d27040007a238
foobar
user@debian:~/bah/getting-started-app$ buildah run foobar /bin/sh
/app # 
/app #  Ctrl-D
user@debian:~/bah/getting-started-app$ 
@baryluk
Copy link
Author

baryluk commented Apr 24, 2024

For completness, this is what the container looks like in buildah inspect

user@debian:~/bah/getting-started-app$ buildah inspect 7e6deb616bab61297dfbbb728e541dff396d5475a98cc60fef4d27040007a238

{
    "Type": "buildah 0.0.1",
    "FromImage": "",
    "FromImageID": "7e6deb616bab61297dfbbb728e541dff396d5475a98cc60fef4d27040007a238",
    "FromImageDigest": "sha256:68dd71cb5eefffdb415ccfd7b7cdc03463cce6201e6ecc782de0cbd343ebc3f4",
    "GroupAdd": null,
    "Config": "{\"created\":\"2024-04-24T22:45:49.537022053Z\",\"container\":\"a0e4c31dfcdd4c57238e9b35fbba3164be1e63f43f87b6b5fa690a4067f84d67\",\"container_config\":{\"Hostname\":\"9cdd21a7cd89\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"ExposedPorts\":{\"3000/tcp\":{}},\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":[\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\",\"NODE_VERSION=18.20.2\",\"YARN_VERSION=1.22.19\"],\"Cmd\":[\"node\",\"src/index.js\"],\"Image\":\"sha256:f79116a5f3aa2f3fed8763270df2155e6105ee5add722f2da0a516b7f04e9cd4\",\"Volumes\":{},\"WorkingDir\":\"/app\",\"Entrypoint\":[\"docker-entrypoint.sh\"],\"OnBuild\":[],\"Labels\":{\"io.buildah.version\":\"1.33.7\"}},\"config\":{\"Hostname\":\"9cdd21a7cd89\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"ExposedPorts\":{\"3000/tcp\":{}},\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":[\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\",\"NODE_VERSION=18.20.2\",\"YARN_VERSION=1.22.19\"],\"Cmd\":[\"node\",\"src/index.js\"],\"Image\":\"sha256:f79116a5f3aa2f3fed8763270df2155e6105ee5add722f2da0a516b7f04e9cd4\",\"Volumes\":{},\"WorkingDir\":\"/app\",\"Entrypoint\":[\"docker-entrypoint.sh\"],\"OnBuild\":[],\"Labels\":{\"io.buildah.version\":\"1.33.7\"}},\"architecture\":\"amd64\",\"os\":\"linux\",\"rootfs\":{\"type\":\"layers\",\"diff_ids\":[\"sha256:a9b5c91e135f50361e86ef92a823db46b49ab4eb6d573ecb564146fd98d80e4b\"]},\"history\":[{\"created\":\"2024-04-24T22:45:40.387071981Z\",\"created_by\":\"/bin/sh -c #(nop) WORKDIR /app\",\"empty_layer\":true},{\"created\":\"2024-04-24T22:45:40.653654236Z\",\"created_by\":\"/bin/sh -c #(nop) COPY dir:c3c71aafb79873f34277e8aeb379755a623f3d38b9733610698ffe860fa5bf5e in . \",\"empty_layer\":true},{\"created\":\"2024-04-24T22:45:49.484275825Z\",\"created_by\":\"/bin/sh -c yarn install --production\",\"empty_layer\":true},{\"created\":\"2024-04-24T22:45:49.510496594Z\",\"created_by\":\"/bin/sh -c #(nop) CMD [\\\"node\\\", \\\"src/index.js\\\"]\",\"empty_layer\":true},{\"created\":\"2024-04-24T22:45:53.29302891Z\",\"created_by\":\"/bin/sh -c #(nop) EXPOSE 3000\",\"comment\":\"FROM docker.io/library/node:18-alpine\"}]}",
    "Manifest": "{\"schemaVersion\":2,\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"config\":{\"mediaType\":\"application/vnd.docker.container.image.v1+json\",\"size\":2093,\"digest\":\"sha256:7e6deb616bab61297dfbbb728e541dff396d5475a98cc60fef4d27040007a238\"},\"layers\":[{\"mediaType\":\"application/vnd.docker.image.rootfs.diff.tar\",\"size\":228850176,\"digest\":\"sha256:a9b5c91e135f50361e86ef92a823db46b49ab4eb6d573ecb564146fd98d80e4b\"}]}",
    "Container": "",
    "ContainerID": "",
    "MountPoint": "",
    "ProcessLabel": "",
    "MountLabel": "",
    "ImageAnnotations": {},
    "ImageCreatedBy": "",
    "OCIv1": {
        "created": "2024-04-24T22:45:49.537022053Z",
        "architecture": "amd64",
        "os": "linux",
        "config": {
            "ExposedPorts": {
                "3000/tcp": {}
            },
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "NODE_VERSION=18.20.2",
                "YARN_VERSION=1.22.19"
            ],
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "Cmd": [
                "node",
                "src/index.js"
            ],
            "WorkingDir": "/app",
            "Labels": {
                "io.buildah.version": "1.33.7"
            }
        },
        "rootfs": {
            "type": "layers",
            "diff_ids": [
                "sha256:a9b5c91e135f50361e86ef92a823db46b49ab4eb6d573ecb564146fd98d80e4b"
            ]
        },
        "history": [
            {
                "created": "2024-04-24T22:45:40.387071981Z",
                "created_by": "/bin/sh -c #(nop) WORKDIR /app",
                "empty_layer": true
            },
            {
                "created": "2024-04-24T22:45:40.653654236Z",
                "created_by": "/bin/sh -c #(nop) COPY dir:c3c71aafb79873f34277e8aeb379755a623f3d38b9733610698ffe860fa5bf5e in . ",
                "empty_layer": true
            },
            {
                "created": "2024-04-24T22:45:49.484275825Z",
                "created_by": "/bin/sh -c yarn install --production",
                "empty_layer": true
            },
            {
                "created": "2024-04-24T22:45:49.510496594Z",
                "created_by": "/bin/sh -c #(nop) CMD [\"node\", \"src/index.js\"]",
                "empty_layer": true
            },
            {
                "created": "2024-04-24T22:45:53.29302891Z",
                "created_by": "/bin/sh -c #(nop) EXPOSE 3000",
                "comment": "FROM docker.io/library/node:18-alpine"
            }
        ]
    },
    "Docker": {
        "created": "2024-04-24T22:45:49.537022053Z",
        "container": "a0e4c31dfcdd4c57238e9b35fbba3164be1e63f43f87b6b5fa690a4067f84d67",
        "container_config": {
            "Hostname": "9cdd21a7cd89",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "3000/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "NODE_VERSION=18.20.2",
                "YARN_VERSION=1.22.19"
            ],
            "Cmd": [
                "node",
                "src/index.js"
            ],
            "Image": "sha256:f79116a5f3aa2f3fed8763270df2155e6105ee5add722f2da0a516b7f04e9cd4",
            "Volumes": {},
            "WorkingDir": "/app",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": [],
            "Labels": {
                "io.buildah.version": "1.33.7"
            }
        },
        "config": {
            "Hostname": "9cdd21a7cd89",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "3000/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "NODE_VERSION=18.20.2",
                "YARN_VERSION=1.22.19"
            ],
            "Cmd": [
                "node",
                "src/index.js"
            ],
            "Image": "sha256:f79116a5f3aa2f3fed8763270df2155e6105ee5add722f2da0a516b7f04e9cd4",
            "Volumes": {},
            "WorkingDir": "/app",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": [],
            "Labels": {
                "io.buildah.version": "1.33.7"
            }
        },
        "architecture": "amd64",
        "os": "linux",
        "rootfs": {
            "type": "layers",
            "diff_ids": [
                "sha256:a9b5c91e135f50361e86ef92a823db46b49ab4eb6d573ecb564146fd98d80e4b"
            ]
        },
        "history": [
            {
                "created": "2024-04-24T22:45:40.387071981Z",
                "created_by": "/bin/sh -c #(nop) WORKDIR /app",
                "empty_layer": true
            },
            {
                "created": "2024-04-24T22:45:40.653654236Z",
                "created_by": "/bin/sh -c #(nop) COPY dir:c3c71aafb79873f34277e8aeb379755a623f3d38b9733610698ffe860fa5bf5e in . ",
                "empty_layer": true
            },
            {
                "created": "2024-04-24T22:45:49.484275825Z",
                "created_by": "/bin/sh -c yarn install --production",
                "empty_layer": true
            },
            {
                "created": "2024-04-24T22:45:49.510496594Z",
                "created_by": "/bin/sh -c #(nop) CMD [\"node\", \"src/index.js\"]",
                "empty_layer": true
            },
            {
                "created": "2024-04-24T22:45:53.29302891Z",
                "created_by": "/bin/sh -c #(nop) EXPOSE 3000",
                "comment": "FROM docker.io/library/node:18-alpine"
            }
        ]
    },
    "DefaultMountsFilePath": "",
    "Isolation": "oci",
    "NamespaceOptions": [
        {
            "Name": "cgroup",
            "Host": false,
            "Path": ""
        },
        {
            "Name": "ipc",
            "Host": false,
            "Path": ""
        },
        {
            "Name": "mount",
            "Host": false,
            "Path": ""
        },
        {
            "Name": "network",
            "Host": false,
            "Path": ""
        },
        {
            "Name": "pid",
            "Host": false,
            "Path": ""
        },
        {
            "Name": "user",
            "Host": true,
            "Path": ""
        },
        {
            "Name": "uts",
            "Host": false,
            "Path": ""
        }
    ],
    "Capabilities": null,
    "ConfigureNetwork": "NetworkDefault",
    "CNIPluginPath": "",
    "CNIConfigDir": "",
    "IDMappingOptions": {
        "HostUIDMapping": true,
        "HostGIDMapping": true,
        "UIDMap": [],
        "GIDMap": [],
        "AutoUserNs": false,
        "AutoUserNsOpts": {
            "Size": 0,
            "InitialSize": 0,
            "PasswdFile": "",
            "GroupFile": "",
            "AdditionalUIDMappings": null,
            "AdditionalGIDMappings": null
        }
    },
    "History": [
        {
            "created": "2024-04-24T22:45:40.387071981Z",
            "created_by": "/bin/sh -c #(nop) WORKDIR /app",
            "empty_layer": true
        },
        {
            "created": "2024-04-24T22:45:40.653654236Z",
            "created_by": "/bin/sh -c #(nop) COPY dir:c3c71aafb79873f34277e8aeb379755a623f3d38b9733610698ffe860fa5bf5e in . ",
            "empty_layer": true
        },
        {
            "created": "2024-04-24T22:45:49.484275825Z",
            "created_by": "/bin/sh -c yarn install --production",
            "empty_layer": true
        },
        {
            "created": "2024-04-24T22:45:49.510496594Z",
            "created_by": "/bin/sh -c #(nop) CMD [\"node\", \"src/index.js\"]",
            "empty_layer": true
        },
        {
            "created": "2024-04-24T22:45:53.29302891Z",
            "created_by": "/bin/sh -c #(nop) EXPOSE 3000",
            "comment": "FROM docker.io/library/node:18-alpine"
        }
    ],
    "Devices": null
}

@rhatdan
Copy link
Member

rhatdan commented Apr 25, 2024

Do you get the same error when attempting to run the container with podman?

@rhatdan
Copy link
Member

rhatdan commented Apr 25, 2024

@mtrmac @nalind Looks like we are dropping CMD when creating a docker-archive?

@baryluk You could attempt to push the container directly into docker using the docker-daemon transport.

@nalind
Copy link
Member

nalind commented Apr 25, 2024

Use docker load to load docker-archive archives, which aim to be in the format that docker save creates.

@baryluk
Copy link
Author

baryluk commented May 3, 2024

@rhatdan @nalind I will try with docker load, and with podman.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants