educative.io

What to do if getting error -> no suitable node (unsupported platform on 1 node)

After running " docker service create --name web_app -p 5000:5000 venky8283/flask_app:3.0 " as directed, I’m presented with the error →

6hco3h8oe56sm88j2bda1afz2
overall progress: 0 out of 1 tasks
1/1: no suitable node (unsupported platform on 1 node)
Operation continuing in background.
Use docker service ps 6hco3h8oe56sm88j2bda1afz2 to check progress.

For context, I’m running a Mac M1 machine with the latest OS installed.

@Alexander_Gurfinkel, The error message no suitable node (unsupported platform on 1 node) suggests that the Docker image venky8283/flask_app:3.0 you are trying to run is not compatible with your Mac M1’s architecture. The M1 chip uses the ARM architecture, whereas many Docker images are built for x86_64 (AMD64) architecture.

To resolve this issue, you have a few options:

  1. Find or Build an ARM-Compatible Image:

    • Check if there is an ARM-compatible version of the venky8283/flask_app:3.0 image available. You can look for tags that might indicate ARM compatibility (like arm64, armv8, etc.).
    • If an ARM-compatible version is not available, you may need to build the image yourself on your M1 machine. This ensures that the image is compatible with ARM architecture.
  2. Use Docker’s Buildx for Multi-Architecture Builds:

    • Docker’s Buildx is a feature that allows you to build images for multiple architectures from a single machine. If you have access to the Dockerfile for venky8283/flask_app:3.0, you can use Buildx to build an ARM-compatible version of the image.
  3. Run an x86_64 Emulation:

    • Your Mac M1 can run x86_64 (Intel-based) Docker images using emulation, although this might have performance impacts. To enable this, you can use the --platform flag when running the Docker command. For example:
      docker service create --name web_app -p 5000:5000 --platform linux/amd64 venky8283/flask_app:3.0
      
  4. Check for Updates or Alternatives:

    • Sometimes, image maintainers update their repositories to include ARM-compatible images. Check the Docker Hub or the repository for updates or alternative images that support ARM architecture.
    • If venky8283/flask_app:3.0 is a third-party image, consider looking for other similar images that are compatible with ARM.
  5. Verify Your Docker Desktop Settings:

    • Ensure that your Docker Desktop is up to date and correctly configured for your M1 Mac. Check the Docker Desktop settings to see if there’s an option to favor ARM images.

Remember, running x86_64 images on ARM architecture through emulation might not always work perfectly and can lead to reduced performance. Whenever possible, using an ARM-native image is the best approach.
Happy Learning :blush:

1 Like