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

Custom command for containers not working #476

Closed
troglobit opened this issue Jun 12, 2024 · 0 comments · Fixed by #486
Closed

Custom command for containers not working #476

troglobit opened this issue Jun 12, 2024 · 0 comments · Fixed by #486
Assignees
Labels
bug Something isn't working
Milestone

Comments

@troglobit
Copy link
Contributor

Setting up a container with a custom command does not seem to be working properly:

admin@infix-00-00-00:/config/> edit container httpd
admin@infix-00-00-00:/config/container/httpd/> set image oci-archive:/lib/oci/curios-httpd-v24.03.0.tar.gz
admin@infix-00-00-00:/config/container/httpd/> set command "curios-httpd-v24.03.0 /usr/sbin/httpd -f -v -p 8080"                 -I/home/jocke/src/x-misc/output/build/edk2-edk2-stable202308/MdePkg/Test/UnitTest/Incutput/build/edk2-edk2-stable202308
admin@infix-00-00-00:/config/container/httpd/> set network host
admin@infix-00-00-00:/config/container/httpd/> set command "/usr/sbin/httpd -f -v -p 8080"
admin@infix-00-00-00:/config/container/httpd/> show
image oci-archive:/lib/oci/curios-httpd-v24.03.0.tar.gz;
command "/usr/sbin/httpd -f -v -p 8080";
network {
  host true;
}
admin@infix-00-00-00:/config/container/httpd/> leave
admin@infix-00-00-00:/> copy running-config startup-config 

The log shows:

Jun 12 08:44:31 infix-00-00-00 container[3157]: Got create args: httpd oci-archive:/lib/oci/curios-httpd-v24.03.0.tar.gz /usr/sbin/httpd -f -v -p 8080
Jun 12 08:44:31 infix-00-00-00 container[3157]: Extracting OCI archive /lib/oci/curios-httpd-v24.03.0.tar.gz ...                308/Build/OvmfX64/DEBUG_GCC5/X64/CryptoPkg/Library/BaseCryptLib/BaseCryptLib/OUTPUT/Hake/src/x-misc/output/build/edk2-ed
Jun 12 08:44:31 infix-00-00-00 container[3157]: Loading OCI image curios-httpd-v24.03.0 ...
Jun 12 08:44:32 infix-00-00-00 container[3157]: ---------------------------------------
Jun 12 08:44:32 infix-00-00-00 container[3157]: Got name: httpd image: curios-httpd-v24.03.0
Jun 12 08:44:32 infix-00-00-00 container[3157]: Got networks: host
Jun 12 08:44:32 infix-00-00-00 container[3157]: Calling podman create --name httpd --conmon-pidfile=/run/container:httpd.pid  --replace --quiet --cgroup-parent=containers  --restart=always --systemd=false --tz=local      --entrypoint=""   --log-driver k8s-file --log-opt path=/run/containers/httpd.fifo --net=host curios-httpd-v24.03.0 /usr/sbin/httpd -f -v -p 8080                   misc/output/build/edk2-edk2-stable202308/Cry
Jun 12 08:44:32 infix-00-00-00 container[2813]: fac5da6019a24253aba41c93abf54478d482a5eb11132abb638e3cfd75f80c7e
Jun 12 08:44:32 infix-00-00-00 container[3157]: Successfully created container httpd from curios-httpd-v24.03.0
Jun 12 08:44:32 infix-00-00-00 finit[1]: Starting k8s-logger:httpd[3257]
Jun 12 08:44:32 infix-00-00-00 httpd[0]: creating pidfile /run/k8s-logger-httpd.pid
Jun 12 08:44:32 infix-00-00-00 httpd[0]: opening fifo /run/containers/httpd.fifo
Jun 12 08:44:32 infix-00-00-00 httpd[0]: entering poll loop ...
Jun 12 08:44:32 infix-00-00-00 finit[1]: Calling 'container -n httpd start' ...
Jun 12 08:44:32 infix-00-00-00 finit[1]: Started container:httpd[3273]
Jun 12 08:44:32 infix-00-00-00 httpd[0]: opening fifo /run/containers/httpd.fifo
Jun 12 08:44:32 infix-00-00-00 httpd[0]: entering poll loop ...
Jun 12 08:44:32 infix-00-00-00 finit[1]: Stopped container:httpd[3273]
Jun 12 08:44:34 infix-00-00-00 finit[1]: Service container:httpd[0] died, restarting in 2000 msec (1/10)
Jun 12 08:44:34 infix-00-00-00 finit[1]: Calling 'container -n httpd start' ...
Jun 12 08:44:34 infix-00-00-00 finit[1]: Started container:httpd[3312]
Jun 12 08:44:34 infix-00-00-00 httpd[0]: opening fifo /run/containers/httpd.fifo
Jun 12 08:44:34 infix-00-00-00 httpd[0]: entering poll loop ...
Jun 12 08:44:34 infix-00-00-00 finit[1]: Stopped container:httpd[3312]
Jun 12 08:44:35 infix-00-00-00 udhcpc[3345]: action bound
Jun 12 08:44:35 infix-00-00-00 udhcpc[3345]: deleting DHCP routes from e1
Jun 12 08:44:36 infix-00-00-00 finit[1]: Service container:httpd[0] died, restarting in 2000 msec (2/10)
...

Finit tries to restart it 10 times and then gives up.

Calling container -n httpd start (same as Finit) gives the following output:

admin@infix-00-00-00:~$ sudo container -n httpd start
Error: unable to start container "fac5da6019a24253aba41c93abf54478d482a5eb11132abb638e3cfd75f80c7e": crun: executable file `""` not found in $PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found

Creating another container, using the same command, and manually starting it, works:

admin@infix-00-00-00:~$ sudo podman create --name foo --conmon-pidfile=/run/container:httpd.pid  --replace --quiet --cgroup-parent=containers  --restart=always --systemd=false --tz=local      --entrypoint=""   --log-driver k8s-file --log-opt path=/run/containers/httpd.fifo --net=host curios-httpd-v24.03.0 /usr/sbin/httpd -f -v -p 8080
d7c7cd82ba7c22cf2fde606d4bb92714c4926b2108c49aa50dd823215f3304d8
admin@infix-00-00-00:~$ sudo podman start foo
foo
admin@infix-00-00-00:~$ sudo podman ps
CONTAINER ID  IMAGE                                   COMMAND               CREATED        STATUS        PORTS       NAMES
d7c7cd82ba7c  localhost/curios-httpd-v24.03.0:latest  /usr/sbin/httpd -...  5 seconds ago  Up 2 seconds              foo

Even connecting to httpd on port 8080 from the outside works:

$ curl http://192.168.122.161:8080/
<!DOCTYPE html>
<html>
  <head>
    <title>curiOS httpd</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
      body {
	 background: #555;
      }

      .content {
	 border-radius: 15px 50px;
	 max-width: 550px;
	 margin: auto;
	 background: white;
	 padding: 20px;
      }
    </style>
  </head>
  <body>
    <div class="content">
      <h1>It works!</h1>
      <p>
	If you see this, the tiny web server from the curiOS docker
	container has started and is serving its default content.
      </p>
      <footer>
	<small>
	 &copy; 2024 The curiOS project, no rights reserved,
	 <a href="https://kernelkit.github.io">https://kernelkit.github.io</a>
	</small>
      </footer>
    </div>
  </body>
</html>
@troglobit troglobit added the bug Something isn't working label Jun 12, 2024
@troglobit troglobit added this to the Infix v24.06 milestone Jun 12, 2024
mattiaswal added a commit that referenced this issue Jun 15, 2024
This made it impossible to use the "command" in container
configuration.

This fix issue #476
mattiaswal added a commit that referenced this issue Jun 17, 2024
This made it impossible to use the "command" in container
configuration.

This fix issue #476
mattiaswal added a commit that referenced this issue Jun 17, 2024
This made it impossible to use the "command" in container
configuration.

This fix issue #476
mattiaswal added a commit that referenced this issue Jun 17, 2024
This made it impossible to use the "command" in container
configuration.

This fix issue #476
mattiaswal added a commit that referenced this issue Jun 19, 2024
This made it impossible to use the "command" in container
configuration.

This fix issue #476
@mattiaswal mattiaswal mentioned this issue Jun 19, 2024
13 tasks
mattiaswal added a commit that referenced this issue Jun 19, 2024
This made it impossible to use the "command" in container
configuration.

This fix issue #476
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants