Instructions to use sdm inside a Docker container#281
Instructions to use sdm inside a Docker container#281omya3qno wants to merge 1 commit intogitbls:masterfrom
Conversation
|
Thank you🙏Will have a look! |
If you are new to docker, https://docs.docker.com/engine/install/debian/ has the instructions to get the 'hello-world' example running. |
|
I must be dumb today. I set up a new system, installed docker, set up the working directory, and ran the file: sudo docker run --privileged --network host --rm \
-v "$(pwd)/myscript.sh:/myscript.sh" \
-v "$(pwd)/working_dir:/root/sdm_working_dir" \
--device=/dev/loop-control \
--device=/dev/loop0 \
debian:latest bash /myscript.shwhich gave the following output: My questions:
Thx! |
Indeed, myscript.sh should be a file, not a directory. See lines 13 to 38 of the as to what could/should be in that file.
Yes. It takes a directory from the host, and makes its content (here: the to be customized image) available to the docker container. Also, when the container writes into this directory (here: the burned image file), the content becomes available on the host.
It makes a device from the host (here: the loop device and its control) available to the container. So when the container calls
|
|
Indeed, when everything is set up properly (which I would have done first go if I had read your notes a bit more carefully 🫤) it works. So far, the only thing I see that I don't care for is that each time I do the Thx! |
Let me know where the language or format could be clearer.
Yes, that is possible. However (a) the majority of the runtime is spent in qemu doing an Therefore I didn't bother. If you care strongly about this, I'll add the instructions, but I think it is not worth it. |
If anyone tries to use this at the far end of a slow internet connection, they will be unhappy. I would like to see how to do it statefully as well, as an alternative. Thx! |
|
To do this in a stateful manner, it is possible to split the However, I'm not convinced this is worth it. The user might forget to run the |
|
Thx. Will have another look at this when I'm free in about 2 weeks. |
|
I've run into an issue in working through this. Pretty sure I didn't see this before, but now I am, and I'm stuck. dodocker myscript.sh I mounted a customized IMG on /mnt/sdm elsewhere before running dodocker. Here's the abbreviated output: Primary issue is the 'failed to open system bus'. The 'attempted to remove disk' error is probably due to the hokie way I have it mounted, so not an issue (yet 🫤) Thx for your assistance! |
|
Looks to me like you try to use systemd-nspawn inside of the docker container. I'm not sure that is supported. Qemu does work, though. |
|
I narrowed down to this test because using sdm per your instructions was getting the error I noted. But you didn't specify using |
|
This is working for me on Windows: |
|
@omya3qno Is it possible to use this approach when building docker image? I have not found how can I attach loop device while building. |
|
For my CI-execution scenario, this approach couldn’t work because it assumes mapping |
I agree with you. I think the only way to do it without needing the I know it is a bit ugly to unpack an .img file and repack it but I guess it is the only option. |
No description provided.