2
votes

This is my first time using google cloud platform and feeling a bit lost.

I pushed my custom ubuntu image (created from a Dockerfile) to GCE and then created a container cluster from the console.

What I got is: a container cluster and a vm instances cluster.

I can ssh into these instances and see them blank, I mean it does not have what I built from the Dockerfile on my system. I copied some source code into it. I did docker images in the whatever instance I sshed but could not see the image I pushed.

I am totally lost now. My basic question is How do I see contents of my container or how do I ssh into it.

I tried following some tutorials but no success. For ex: I tried this command gcloud compute instances list and got some big string (gke-cluster-1-53f024ac-node-s5zc) as instance name. When I tried this command gcloud compute ssh gke-cluster-1-53f024ac-node-s5zc I got error that instance not found.

Please help.

Thanks

1
Is your issue resolved?Kamran
@Kamran No. I switched to the local environment.user3275095

1 Answers

3
votes

To log into a container, use the following command:

kubectl exec -it POD bash

Replace POD with the name of the pod in which the container is running. This works for pods with a single container. For pods with multiple containers, use the -c option to specify the container.