ntBre / rdkit-rs

RDKit interface in safe Rust
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Docker image does not run on Mac #3

Open bertiewooster opened 6 months ago

bertiewooster commented 6 months ago

On a Mac, either ARM64 (Apple Silicon M2) or Intel, the Docker image from Docker Hub crashes immediately after I try to run it in a container. Here's the log from docker events from the ARM64 Mac:

2024-03-23T11:13:24.033041711-04:00 network connect 282b2c1089d54c2c55866abca1d0d5b1e2eed525892471c68d41268a2f98e0c7 (container=86d6b36afce3a53812e749400d23d418e15a384795d4350e65238e7f0723b9f0, name=bridge, type=bridge)
2024-03-23T11:13:24.104343586-04:00 container start 86d6b36afce3a53812e749400d23d418e15a384795d4350e65238e7f0723b9f0 (image=ntbre/rdkit-rs:latest, name=objective_archimedes, org.opencontainers.image.authors=Santiago Torres-Arias <santiago@archlinux.org> (@SantiagoTorres), Christian Rebischke <Chris.Rebischke@archlinux.org> (@shibumi), Justin Kromlinger <hashworks@archlinux.org> (@hashworks), org.opencontainers.image.created=2024-01-01T19:08:40+00:00, org.opencontainers.image.description=Official containerd image of Arch Linux, a simple, lightweight Linux distribution aimed for flexibility., org.opencontainers.image.documentation=https://wiki.archlinux.org/title/Docker#Arch_Linux, org.opencontainers.image.licenses=GPL-3.0-or-later, org.opencontainers.image.revision=98cd79111dd530447f491d547d14f3c38e227e46, org.opencontainers.image.source=https://gitlab.archlinux.org/archlinux/archlinux-docker, org.opencontainers.image.title=Arch Linux base Image, org.opencontainers.image.url=https://gitlab.archlinux.org/archlinux/archlinux-docker/-/blob/master/README.md, org.opencontainers.image.version=20240101.0.204074)
2024-03-23T11:13:24.204617919-04:00 network disconnect 282b2c1089d54c2c55866abca1d0d5b1e2eed525892471c68d41268a2f98e0c7 (container=86d6b36afce3a53812e749400d23d418e15a384795d4350e65238e7f0723b9f0, name=bridge, type=bridge)
2024-03-23T11:13:24.210121586-04:00 container die 86d6b36afce3a53812e749400d23d418e15a384795d4350e65238e7f0723b9f0 (execDuration=0, exitCode=0, image=ntbre/rdkit-rs:latest, name=objective_archimedes, org.opencontainers.image.authors=Santiago Torres-Arias <santiago@archlinux.org> (@SantiagoTorres), Christian Rebischke <Chris.Rebischke@archlinux.org> (@shibumi), Justin Kromlinger <hashworks@archlinux.org> (@hashworks), org.opencontainers.image.created=2024-01-01T19:08:40+00:00, org.opencontainers.image.description=Official containerd image of Arch Linux, a simple, lightweight Linux distribution aimed for flexibility., org.opencontainers.image.documentation=https://wiki.archlinux.org/title/Docker#Arch_Linux, org.opencontainers.image.licenses=GPL-3.0-or-later, org.opencontainers.image.revision=98cd79111dd530447f491d547d14f3c38e227e46, org.opencontainers.image.source=https://gitlab.archlinux.org/archlinux/archlinux-docker, org.opencontainers.image.title=Arch Linux base Image, org.opencontainers.image.url=https://gitlab.archlinux.org/archlinux/archlinux-docker/-/blob/master/README.md, org.opencontainers.image.version=20240101.0.204074)

I can run another Docker image in a container on each computer, so my overall Docker setup seems OK.

ntBre commented 6 months ago

I'm new to Docker and don't have a Mac to test on, so I don't really know how to start debugging this. Have you tried running other Linux containers? If those work, have you tried the archlinux base image that mine is built on top of? I'm just trying to figure out if this is a problem with my Dockerfile or image or a more general problem.

bertiewooster commented 4 months ago

I tried deploying the container image to Google Cloud Run and got these errors:

ERROR 2024-05-17T03:06:12.854409Z Default STARTUP TCP probe failed 1 time consecutively for container "***" on port 8080. The instance was not started.

Ready condition status changed to False for Revision *** with message: The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.

Doesn't seem to be much detail there. The help docs talk mostly about the port and network interfaces the container is listening on. Is anything about the ports configuration in the Docker image?

I was able to run a test container on Google Cloud Run, so the problem seems to be something specific to this rdkit-rs container.

bertiewooster commented 4 months ago

ChatGPT says

Google Cloud Run requires that your Docker container specifies an entry point or command to start the application. If your Dockerfile doesn't specify this, the container will fail to start.

Ensure your Dockerfile specifies a CMD or ENTRYPOINT. For example, if your application has a binary to run, you should add:

CMD ["/path/to/your/application"]

The Dockerfile in this repo doesn't have a CMD or ENTRYPOINT; could you add one? For a crate named hello-world, ChatGPT says the CMD should be

CMD ["/app/target/release/hello-world"]

ntBre commented 4 months ago

Thanks for resurrecting this. I finally figured out how to get an M1 Mac runner for the actions, so I can actually see if any of the fixes work now.

In this case, could you try adding the CMD section and running that directly? That seems a bit easier than me adding it since I can't try it out. I'd be glad to accept a PR if it works.

bertiewooster commented 4 months ago

could you try adding the CMD section and running that directly?

I can't run the Docker container on my computer; could you create the updated image on Docker Hub, and then I can try it on Google Cloud Run? I'll submit a PR with what I believe the CMD should be.

ntBre commented 4 months ago

I was at a conference last week but have more time to look at this now. I don't quite understand what you're trying to accomplish with this entry point command. This seems to make sense only for cases where the command is a web server or something that you can interact with after running it. Are you just trying to get something to work at all?

The current Dockerfile doesn't even clone or install rdkit-rs (or create a /app directory as far as I know), so I don't think the CMD in the PR has any chance of working.

I'm a bit resistant to work on this because the feedback loop is going to be very long. I have to make a change to the Dockerfile, upload a new image to DockerHub, and then wait for you to run it on Google Cloud Run to know if it worked. Surely there must be a better way.

With my limited knowledge of Docker, I thought this was exactly what it was to be used for. Did you not get any more useful output from trying to build an image from the Dockerfile or from running the image from DockerHub? What did you use for your docker run command? From a very brief search, dying immediately is expected unless you passed it a command to run to keep it alive. For example, I have docker run --rm -it ntbre/rdkit-rs bash in my command history to run the image and use bash as the entry point. This gives me a shell from which I can clone the repo and run the tests.

I just repeated this command and confirmed that it works on my machine, with the caveat that I had to run rustup update because an old nightly version is now present in the image. But that didn't have any effect on the startup of the container, only on actually running the example code from the readme.