1
votes

I'm creating an instance template under GCP's Cloud Engine section.

Usually when deploying a docker image, there's a docker file that includes some startup scripts after specifying the base image to pull and build, but I can't see where I can either submit a docker file, or enter startup scripts.

I can see a field for startup scripts for the Cloud Compute instance, but that's different from the scripts passed on for the Docker's startup.

Are these perhaps to be filled in under "Command", "Command arguments", or "Environment Variables"?

Screenshot of the GUI I'm seeing

For clarification, this is someone else's image of a dockerfile I pulled from Google Images. The part I wish to add is "rectangled" in red, the RUN commands, but not these exact commands.

In my case, I would like to add something like

RUN python /pythonscript.py

RUN commands

2

2 Answers

0
votes

If I understood well, you are trying to create a Docker image not a compute instance image.

Compute instance can run a docker image that you already builded and pushed to either gcr or any other repository.

Try to build your docker image normaly, push it in a docker repo then use it.

0
votes

You can run a startup script directly in the Docker container by using a ‘command’ section. If you need to install something after starting a container for example Apache, you should use a Docker image that has Apache.

If you need to run some other arguments, like creating environment variables, here you can find the full list of flags when creating a container image on VM instance.