Score:1

Create Google Cloud VM using a dockerfile

ru flag

I know how to launch a Compute Engine VM. I know how to install docker, create an image from a dockerfile, and launch a container.

What I want to do is to use a dockerfile as the specification to spin up a VM. For example, go to https://console.cloud.google.com/compute/instances and use the dockerfile below to create my VM:

Dockerfile

FROM rocker/rstudio:latest

SHELL ["/bin/bash", "-c"]
#SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# collect build args
ARG USER
ARG UID
ARG GID

# install stuff
RUN apt update && apt install -y \
        vim \
        iputils-ping \
        wget

# create user $USER
RUN groupadd -g $GID $USER
RUN useradd -rm -d /home/$USER -s /bin/bash -u $UID -g $GID $USER
RUN usermod -a -G sudo $USER
RUN chpasswd <<<$USER:weakpass

There are a zillion guides for the former. But I can't find any for the latter.

John Hanley avatar
cn flag
Dockerfiles are used to build containers. Products such as Terraform and Packer are used to create virtual machines.
jabbson avatar
sb flag
or if you are looking for a google specific way of creating resources from a template file, look into [deployment manager](https://cloud.google.com/deployment-manager/docs/manage-cloud-resources-deployment). Technically, you can create Compute Engine VMs (or other GCP resources) with Dockerfile (for example using [Google Cloud SDK image](https://hub.docker.com/r/google/cloud-sdk/)) but is this what you want?..
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.