Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

container in VM constantly restarting

If I follow the instructions at https://cloud.google.com/compute/docs/instances/create-start-instance for creating an instance with a container:

```

  1. In the Google Cloud console, go to the VM instances page.

    Go to VM instances

  2. Select your project and click Continue.

  3. Click Create instance.

  4. Specify a Name for your VM. For more information, see Resource naming convention.

  5. In the Container section, click Deploy container.

    1. Specify the Container image to use. For example:

      • To select an NGINX 1.12 container image from Cloud Launcher:

        gcr.io/cloud-marketplace/google/nginx1:1.12

      • To deploy an Apache container image from Docker Hub, always specify the full Docker image name:

        docker.io/httpd:2.4

    2. Optional: Click Advanced container options. For more information, see Configuring options to run your container.

  6. To create the VM, boot the VM, and launch the container, click Create.

```

 

...but I use `ubuntu:22.04` (or a similar public container) I cannot run `docker attach`, because that always produces the error:

 

```

You cannot attach to a restarting container, wait until it is running

```

 

However, the docker container continuously restarts every ~1 minute. 

Regardless of the Docker image (public or on Artifact Registry) and the VM config parameters that I use, the docker container in my running VM continuously restarts. The VM logs do not indicate why this is occurring.

I'm surprised that there isn't more troubleshooting documentation on this, given how easy it has been for me to come across this issue (basically every container & VM setup that I've tried).

2 2 1,289