Comments (5)
This error comes from the CDI dependency that's used;
moby/vendor/tags.cncf.io/container-device-interface/pkg/cdi/cache.go
Lines 227 to 248 in bfdb891
Wondering though; comparing your example with the example from #45134, should the containerEdits
be part of the demo1
device? i.e., more like;
cdiVersion: 0.6.0
kind: spidernet.io/test
devices:
- name: demo1
containerEdits:
env:
- LD="test"
I tried reproduce your issue in a docker-in-docker container;
Creating the CDI directories, and /etc/docker
for the daemon config file;
mkdir -p /etc/cdi /var/run/cdi /etc/docker
Configure the daemon;
cat > /etc/docker/daemon.json <<'EOF'
{
"features": {
"cdi": true
}
}
EOF
Create the CDI spec based on your example;
cat > /var/run/cdi/test.yaml <<'EOF'
cdiVersion: 0.6.0
kind: spidernet.io/test
containerEdits:
env:
- LD="test"
devices:
- name: demo1
EOF
Start the daemon;
dockerd
In another shell; run a container;
docker run -it --rm --device spidernet.io/test=demo1 alpine printenv LD
Check the daemon logs, and I see it complains that the spec is invalid;
WARN[2024-03-26T11:39:44.498974429Z] Refreshing the CDI registry generated errors error="1 error occurred:\n\t* failed to load CDI Spec invalid CDI Spec: failed add device \"demo1\": invalid device, empty device edits\n\n"
That error looks to confirm my suspicion that your CDI spec is incorrect; changing the spec to what I think it should be (see my comment further up);
cat > /var/run/cdi/test.yaml <<'EOF'
cdiVersion: 0.6.0
kind: spidernet.io/test
devices:
- name: demo1
containerEdits:
env:
- LD="test"
EOF
This time it worked, and the LD
env-var is set to "test"
;
docker run -it --rm --device spidernet.io/test=demo1 alpine printenv LD
"test"
from moby.
Based on the above, I don't think there's a bug at hand here, so I'll go ahead and close this ticket, but feel free to continue the conversation.
from moby.
Thanks @thaJeztah for the details! This should be a bias in my use, perhaps I should go to the CDI community for help.
from moby.
Thanks! Out of curiosity; was your example test.yaml
based on an example you found somewhere in documentation (so the documentation being incorrect?) or was this something you wrote yourself?
from moby.
was this something you wrote yourself?
woo, I wrote this myself. when I read the CDI docs on https://github.com/cncf-tags/container-device-interface/blob/main/SPEC.md#oci-edits, I found the containerEdits field is referenced in two places in the specification:
- At the device level, where the edits MUST only be made if the matching device is requested by the container runtime user.
- At the container level, where the edits MUST be made if any of the device defined in the devices field are requested.
So even if I don't have containerEdits configured in devices, but I do have container-level containerEdits configured, the runc will be able to take effect on the container-level containerEdits, But it's not working. maybe I misunderstood something.
from moby.
Related Issues (20)
- `docker image ls --filter=reference=docker.io/$MY/$IMG` != `docker image ls --filter=reference=$MY/$IMG`
- Pass proxy settings from host system for Windows containers HOT 1
- Rootless docker cannot start containers bound to different IPs but the same port
- Problem with moby-engine install on raspberry zero w with bullseye.
- Internal network DNS fails to resolve HOT 9
- containerd: classic builder fails to preserve platform information correctly HOT 1
- Cannot create new containers HOT 1
- Running docker containers in existing network namespace (netns) HOT 5
- Failing tests on Apple Chip Mac HOT 2
- [swarm mode] Random published port not accessible upfront using . It needs an update
- New volume mount subpath - does not create sub directory if it doesn't ee
- Add an option to start docker without any containers regardless of their restart policy
- Docker starts containers with restart policy `on-failure` after host reset HOT 1
- failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: “docker-entrypoint.sh”: executable file not found in $PATH: unknown
- [grafana/loki-docker-driver] Docker rootless error mounting "cgroup" to rootfs at "/sys/fs/cgroup"
- A potential goleak in cluster.go HOT 1
- Docker keeps cached manifests and indicies forever somewhere. HOT 4
- Docker compose argument to replace env_file directive, or argument to enable host environment passthrough
- UDP Response Timeout in Bridge Mode Networking
- docker cp --parents should exist, analogous to GNU cp --parents
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moby.