#failed to resolve image docker.io/library/mysql:5.7

1 messages · Page 1 of 1 (latest)

glacial cave
#

I'm trying to take my first steps with dagger by getting my application's unit tests to run via dagger. Part of this is having a MySQL container running for the unit tests to execute against.

I have a mysql container defined like this (using the python sdk):

    @function
    def mysql(self) -> dagger.Container:
        """Returns a container that runs a MySQL service"""
        return (
            dag.container()
            .from_("mysql:5.7")
            .with_env_variable("MYSQL_DATABASE", DB_NAME)
            .with_env_variable("MYSQL_USER", DB_USER)
            .with_env_variable("MYSQL_PASSWORD", DB_PASSWORD)
            .with_exposed_port(3306)
            .as_service()
        )

And for some reason I'm getting the following error:

  ✘ Container.from(address: "mysql:5.7"): Container! 0.8s
  ! failed to resolve image docker.io/library/mysql:5.7: failed to resolve source metadata for docker.io/library/mysql:5.7: no match for platform in manifest: not found
    ✘ resolving docker.io/library/mysql:5.7 0.8s
    ! no match for platform in manifest: not found
      ✔ HTTP GET 0.4s
      ✔ remotes.docker.resolver.HTTPRequest 0.4s

I think the pertinent part is "no match for platform in manifest: not found" but I have no idea what this means :/ I'm on an M1 Mac, if that has any bearing on things... but I'm successfully running mysql in docker (via docker for mac and docker compose) without any issues right now so I'm not sure why dagger would be having issues with it...

Appreciate any insights that people might have.

frozen orchid
#

More recent versions of mysql provide arm64 images, I'd suggest you update the tag

glacial cave
#

I need it to be 5.7 though, since that's what we currently run in production (I know, we should update that... but it is what it is right now and I want CI to match production to prevent us from releasing code that relies on newer features).

I've spotted the issue. My local development environment is using mysql/mysql-server:5.7 and not mysql:5.7. mysql/mysql-server:5.7 is also not built for arm64 but it just prints a warning and then starts anyway.

Thanks for the help 🙂

broken glen
#

I was able to get this to work with amd64 emulation on my Mac and the platform directive to go ahead an use amd64 even though my Mac is arm64 (see below) once I saw that mysql wanted a required env var. 👉 #1267209812341690369 message

===debugging stuff===
On a lark, I ran this against an earlier dagger CLI and engine I had sitting around and got this helpful feedback:

DB_NAME="mydb"
DB_USER="root"
DB_PASSWORD="root"

@object_type
class Ricepuddin:
    @function
    def mysql(self) -> dagger.Container:
        """Returns a container that runs a MySQL service"""
        return (
            dag.container(platform=dagger.Platform("linux/amd64"))
            .from_("mysql:5.7")
            .with_env_variable("MYSQL_DATABASE", DB_NAME)
            .with_env_variable("MYSQL_USER", DB_USER)
            .with_env_variable("MYSQL_PASSWORD", DB_PASSWORD)
            .with_exposed_port(3306)
        )
  ...
    ┃ port not ready: dial tcp 10.87.0.18:3306: connect: connection refused; elapsed: 1.192266917s                                                                                        

Error: response from query: input: container.from.withEnvVariable.withEnvVariable.withEnvVariable.withExposedPort.asService.up resolve: failed to start host service: start upstream: exited: exit code: 1
output: 2024-07-29 05:36:08+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.
2024-07-29 05:36:09+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2024-07-29 05:36:09+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.
2024-07-29 05:36:10+00:00 [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified
    You need to specify one of the following as an environment variable:
    - MYSQL_ROOT_PASSWORD
    - MYSQL_ALLOW_EMPTY_PASSWORD
    - MYSQL_RANDOM_ROOT_PASSWORD
#

@low zinc that was on dagger v0.10.3
versus on v0.12.3
where I couldn't see that in TUI, but found it in the Web UI

(.venv) ricepuddin ➤ dagger call mysql as-service up                                                                                                                                     
Full trace at https://dagger.cloud/jeremy-maert-test-org/traces/99f615c1daa139c87bd917964eb9d262

✔ connect 2.2s
✔ initialize 23.1s
✔ prepare 0.0s
✔ ricepuddin: Ricepuddin! 0.6s
✔ Ricepuddin.mysql: Container! 1.5s
✔ Container.asService: Service! 6.7s
✘ Service.up: Void 6.7s
! failed to start host service: start upstream: exited: exit code: 1

Error: response from query: input: container.from.withEnvVariable.withEnvVariable.withEnvVariable.withExposedPort.asService.up resolve: failed to start host service: start upstream: exited: exit code: 1

where the red error span seems to be the one right after the one we need.
https://dagger.cloud/jeremy-maert-test-org/traces/99f615c1daa139c87bd917964eb9d262?span=ef74ddb0c7887627

#

@glacial cave this worked for me

DB_NAME="mydb"

@object_type
class Ricepuddin:
    @function
    def mysql(self) -> dagger.Container:
        """Returns a container that runs a MySQL service"""
        return (
            dag.container(platform=dagger.Platform("linux/amd64"))
            .from_("mysql:5.7")
            .with_env_variable("MYSQL_DATABASE", DB_NAME)
            .with_env_variable("MYSQL_ALLOW_EMPTY_PASSWORD", "yes")
            .with_exposed_port(3306)
        )
#

Invoked like this:

dagger call mysql as-service up
#

You'll notice I used platform to force pulling the only image even though it doesn't match my MacBook arch of arm64.

dag.container(platform=dagger.Platform("linux/amd64"))

and I'm using Docker Desktop with 👇 (under Settings > General)

#

You can get similar results using Rosetta on Mac silicon with nerdctl/lima and podman, I think
https://github.com/lima-vm/lima/discussions/1797
https://github.com/containers/podman/pull/22757

GitHub

Description I want to use lima to run x86 architecture ubuntu system on my arm chip, but I try to run it through rosetta parameters, but it keeps freezing

GitHub

This is an automated cherry-pick of #21670
/assign mheon
Podman machine can now use Rosetta 2 (a.k.a Rosetta) on macOS with Apple Silicon. This is enabled by default. If you wish to change this opt...

broken glen
#

@low zinc bringing this back up with @warped shuttle

#

Similar to things he's seeing. Hard to find the important part of the error message.

warped shuttle
#

I have the exact same problem and a fresh example 🙂