I can do this successfully:
- Bundle my app into a docker image
- Build this image into a container using Google Cloud Build upon push to master
- (This container is stored in the registry at, for example,
gcr.io/my-project/my-container
)
- (This container is stored in the registry at, for example,
- Deply this container to the web using Google Cloud Run
- Visit the Cloud Run url and see my website
I am now trying more sophisticated builds and I think the next step is to use Google Compute Engine.
To start, I am simply trying to deploy a single instance of the same app that I deployed to Cloud Run:
- Navigate to
Compute Engine > VM Instances
- Enter basics like instance name
- Enter my container location under "Container Image":
gcr.io/my-project/my-container
- (As an aside, I find it suspect that the interface does not offer a selector for your existing Container Registry items here.)
- Select "Allow HTTP Traffic" and "Allow HTTPS Traffic"
- Click "Create"
GCE takes a minute to create it, and then it shows the green checkmark and the instance name, and "External IP: 35.238.xxx.xxx". I visit that URL in my browser and get... "35.238.xxx.xxx refused to connect."
To inspect, I go back to the GCE page and select "SSH > Open in browser window" next to my instance, which opens a type of cloud terminal to the machine.
In this terminal window, type ps
and see that no processes are running. The container Dockerfile
ends with CMD yarn start:prod
, so I guess that's not happening here.
Further, I ls
here and there and navigate around, and see that there is no /app
directory from my Dockerfile
's WORKDIR /app
command. It seems like not only did my app not boot, but was the container not copied to the VM instance?
What am I doing wrong?
gcr.io/cloud-marketplace/google/nginx1:latest
and allowed HTTP/HTTPS connection. I successfully connected tohttp://EXTERNAL_IP_OF_MY_VM
and found expectedWelcome to nginx!
, meanwhile https access didn't work (probably because it's not configured). – Serhii Rohozadocker ps
to check status of deployed container. Also, I've connected to container with commanddocker attach CONTAINER_ID_NAMES
and I was able to see my requests to NGINX web server. After that I disconnected and connected to container with commanddocker exec -it CONTAINER_ID_NAMES /bin/bash
to interact with it. – Serhii Rohozadocker ps
. 3. Connect to your container withdocker attach CONTAINER_ID_NAMES
and/ordocker exec -it CONTAINER_ID_NAMES /bin/bash
and check status of your app. 4. Check logs . Do not forget to check Limitations – Serhii Rohozagcloud
, upon entry it says: "Error. The startup agent encountered errors. Your container was not started. To inspect the agent's logs use 'sudo journalctl -u konlet-startup' command. – cilphex