From: Zheng Junjie <zhengjunjie@iscas.ac.cn>
To: Fabio Natali via Guix-patches via <guix-patches@gnu.org>
Cc: Fabio Natali <me@fabionatali.com>, 71254-done@debbugs.gnu.org
Subject: bug#71254: [PATCH] services: oci-container: fix provided image is string.
Date: Thu, 06 Jun 2024 13:57:06 +0800 [thread overview]
Message-ID: <87sexqvcjx.fsf@iscas.ac.cn> (raw)
In-Reply-To: <87a5jzd4ny.fsf@fabionatali.com> (Fabio Natali via Guix-patches via's message of "Wed, 05 Jun 2024 12:12:33 +0100")
[-- Attachment #1: Type: text/plain, Size: 3591 bytes --]
Fabio Natali via Guix-patches via <guix-patches@gnu.org> writes:
> Hi,
>
> Just a quick follow-up to mention the way I tested this. Possibly a bit
> convoluted, but it worked for me.
>
> Save this to `/tmp/operating-system-test.scm'.
>
> ,----
> | (define-module (operating-system-test)
> | #:use-module (gnu)
> | #:use-module (gnu services admin)
> | #:use-module (gnu services dbus)
> | #:use-module (gnu services desktop)
> | #:use-module (gnu services docker)
> | #:use-module (gnu services networking)
> | #:export (operating-system-test))
> |
> | (define operating-system-test
> | (operating-system
> | (host-name "host")
> | (timezone "Europe/London")
> | (locale "en_US.UTF-8")
> | (bootloader (bootloader-configuration
> | (bootloader grub-bootloader)
> | (targets '("/dev/vda"))))
> | (file-systems (cons
> | (file-system
> | (device "/dev/vda2")
> | (mount-point "/")
> | (type "ext4"))
> | %base-file-systems))
> |
> | (services (cons*
> | (service dhcp-client-service-type)
> | (service docker-service-type)
> | (service elogind-service-type)
> | (service oci-container-service-type
> | (list
> | (oci-container-configuration
> | (image "nginx")
> | (provision "nginx")
> | (network "host"))))
> | %base-services))))
> |
> | operating-system-test
> `----
>
> Then run this to build a system image.
>
> ,----
> | guix system image \
> | --load-path=build \
> | --image-size=20GB \
> | --image-type=qcow2 \
> | /tmp/operating-system-test.scm
> `----
>
> If you are on or around '2e53fa5346bf52f6d6d26e035bc905ebd410dabb', the
> above command will fail with error `In procedure struct-vtable: Wrong
> type argument in position 1 (expecting struct): "nginx"'.
>
> Now try instead from a Guix checkout with Zheng's patch.
>
> ,----
> | orig=$(./pre-inst-env guix system image \
> | --load-path=build \
> | --image-size=20GB \
> | --image-type=qcow2 \
> | /tmp/operating-system-test.scm)
> `----
>
> The command will succeed, and this should be sufficient proof of the
> patch effectiveness. One can of course go on and test the image itself:
>
> ,----
> | dest=/tmp/operating-system-media.qcow2
> | cp "${orig}" "${dest}"
> | chown user:users "${dest}"
> | chmod u+w "${dest}"
> | qemu-system-x86_64 \
> | -enable-kvm \
> | -m 4096 \
> | -smp 2 \
> | -device e1000,netdev=net0 \
> | -netdev user,id=net0,hostfwd=tcp::8080-:80 \
> | -drive if=none,file="${dest}",id=myhd,index=0 \
> | -device virtio-blk,drive=myhd
> `----
>
> There's a bit of manual work to be done here, as in my tests the docker
> container doesn't start straightaway. Log in as root, wait for Docker to
> finish pulling the Nginx image (see `tail -f /var/log/messages' and
> possibly `herd restart dockerd'), then re-enable and start the Nginx
> service (`herd enable nginx && herd start nginx'). After that,
> everything should work as expected, i.e. the Docker Nginx contained in
> the VM answers requests from the host.
>
> Cheers, Fabio.
thanks, now pushed, see https://git.savannah.gnu.org/cgit/guix.git/commit/?id=2b2337f275a6421a0d0964c54987df4ac74162e6
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
prev parent reply other threads:[~2024-06-06 5:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 4:17 [bug#71254] [PATCH] services: oci-container: fix provided image is string Zheng Junjie
2024-05-31 14:14 ` Fabio Natali via Guix-patches via
2024-06-05 11:12 ` Fabio Natali via Guix-patches via
2024-06-06 5:57 ` Zheng Junjie [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sexqvcjx.fsf@iscas.ac.cn \
--to=zhengjunjie@iscas.ac.cn \
--cc=71254-done@debbugs.gnu.org \
--cc=guix-patches@gnu.org \
--cc=me@fabionatali.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).