I new to docker and GCP. I followed the instructions given here
My docker-compose.yml file looks like this:
version: '3'
services: 
  backend:
    image: com.xyz.backend:v1
    build: ./server/
    ports: 
      - "5000:5000"
    volumes:
      - ./server:/usr/src/app
      - /usr/src/app/node_modules
  frontend:
    image: com.xyz.frontend:v1
    build: ./client/
    ports:
      - "3000:3000"
    volumes:
      - ./client:/usr/src/app
      - /usr/src/app/node_modules
    links:
      - backend
Docker file => client/Dockerfile:
FROM node:8.15.0-alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV NODE_PATH=/node_modules
ENV PATH=$PATH:/node_modules/.bin
COPY package.json /usr/src/app
RUN npm i -g npm-check-updates
RUN ncu -u
RUN npm install
COPY . /usr/src/app
ENV PORT 3000
EXPOSE 3000
RUN pwd
CMD ["npm", "start"]
Docker file => server/Dockerfile
FROM node:8.15.0-alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV NODE_PATH=/node_modules
ENV PATH=$PATH:/node_modules/.bin
RUN npm install -g nodemon
COPY package.json /usr/src/app
RUN npm i -g npm-check-updates
RUN ncu -u
RUN npm install
COPY . /usr/src/app
ENV PORT 5000
EXPOSE 5000
RUN pwd
CMD ["npm", "start"]
cloudbuild.yaml
steps:
- name: ‘docker/compose:1.23.2’
  args: [‘up’, ‘-d’]
- name: 'gcr.io/cloud-builders/docker'
  args: ['tag', 'workspace_app:latest', 'gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA']
images: ['gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA']
Project Structure:
Project
↳ client
   ↳ Dockerfile
  server
   ↳ Dockerfile
  README.md
  Dockerfile
  cloudbuild.yaml
  docker-compose.yml
When I try to run this in gcp no errors are thrown but I couldn't access using the public ip.
When I'm running it locally it runs fine.
I run the docker using the following command
docker run     -v /var/run/docker.sock:/var/run/docker.sock     -v "$PWD:$PWD"     -w="$PWD"   docker/compose:1.23.2 up
I tried setting the port also like:
docker run     -v /var/run/docker.sock:/var/run/docker.sock     -v "$PWD:$PWD"     -w="$PWD"  -p 8080:3000   docker/compose:1.23.2 up
Couldn't find where the problem is. Please advice.. Thanks in advance.