Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

Question about “google compute instances create-with-container”

Hi, I am trying to use a container image that I built to make a Python guestbook app that works with a Redis deployment (used Google deployment-manager solution for this Redis deployment). Used the following Dockerfile:

FROM ubuntu:latest

RUN apt-get update &&

apt-get install -y python-dev python-pip &&

pip install redis flask

ADD app /app

EXPOSE 5000

CMD [ "python", "/app/app.py" ]

using the command "gcloud builds submit –tag gcr.io/my_proj/gb-redis ."

The image was built successfully:

DONE

ID CREATE_TIME DURATION SOURCE IMAGES STATUS

f780d9b3-7fcb-44e5-bb89-3eb1653d0015 2019-06-26T01:01:56+00:00 1M52S gs://my_proj_cloudbuild/source/1561510915.26-3a750b915a1048618918f382ab3b994e.tgz gcr.io/my_proj/gb-redis (+1 more) SUCCESS

But when I create a compute instance with the above image using the command "gcloud compute instances create-with-container gb-mnori-try –container-image=gcr.io/my_proj/gb-redis –zone=us-central1-b –tags=cep-allow-ssh,allow-http" and then SSH into it I don’t see the dir /app

mnori@gb-mnori-try ~ $ cd /app

-bash: cd: /app: No such file or directory

May I please know what am missing?

Regards,

Madhavi

Paul

Is there any chance you were in a different directory when you did docker build .? There’s nothing wrong with that Dockerfile.

1 Answers

Hello, 2Madhavinori.  Did Paul’s idea (noted in a comment, above) help?  I’m unfortunately not sure what is the cause of the problem you’re seeing.

To debug problems like this, it can help to start with a very minimal setup–something like a Hello, World!–and then slowly change that into the setup you want–step-by-step and re-verifying after each one.  Then you can identify the key thing that breaks it.

Hope this helps.

Mattias

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?