skip to Main Content

This is my auth-depl.yaml file:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: auth-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: auth
  template:
    metadata:
      labels:
        app: auth
    spec:
      containers:
        - name: auth
          image: tester/auth
          env:
            - name: MONGO_URI
              value: 'mongodb://auth-mongo-srv:27017/auth'
            - name: JWT_KEY
              valueFrom:
                secretKeyRef:
                  name: jwt-secret
                  key: JWT_KEY
---
apiVersion: v1
kind: Service
metadata:
  name: auth-srv
spec:
  selector:
    app: auth
  ports:
    - name: auth
      protocol: TCP
      port: 3000
      targetPort: 3000

And the following is auth-mongo-depl.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: auth-mongo-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: auth-mongo
  template:
    metadata:
      labels:
        app: auth-mongo
    spec:
      containers:
        - name: auth-mongo
          image: mongo
---
apiVersion: v1
kind: Service
metadata:
  name: auth-mongo-srv
spec:
  selector:
    app: auth-mongo
  ports:
    - name: db
      protocol: TCP
      port: 27017
      targetPort: 27017

When I run skaffold dev it gives me the following error:

 - deployment/auth-mongo-depl: container auth-mongo is waiting to start: mongo can't be pulled
    - pod/auth-mongo-depl-64f5f58669-dw4hg: container auth-mongo is waiting to start: mongo can't be pulled
 - deployment/auth-mongo-depl failed. Error: container auth-mongo is waiting to start: mongo can't be pulled.

The mongo service is up and running and I can run mongo command on the terminal. It also starts and runs on it’s default mongodb://127.0.0.1:27017 address. I use Windows 10 and Docker-Desktop.

Let me know if more information needs to be added.

3

Answers


  1. I think the common solution is to pull the mongo image in Docker Hub to your local machine and then try to run skaffold dev again

    Login or Signup to reply.
  2. I had a similar issue, and this was how I resolved it. I went to my Docker Desktop app (Mac) and did a clean-up of all the docker images. I basically deleted all the images which also include mongo image.

    enter image description here

    enter image description here

    Then I ran skaffold dev and all the images were built again, and a fresh copy of mongo was added to my Docker Desktop app. Now, my code started successfully without mongo error. I hope this helps

    Login or Signup to reply.
  3. I had a similar issue (took me 3 hours to figure out) and what I had to do was set a local or global default repo in the Skaffold context:

    Global
    skaffold config set default-repo <your-dockerhub-repo>

    Local Project
    skaffold dev --default-repo <myrepo>

    Also in my skaffold.yaml I had to set push to true:

    build:
      local:
        push: true
    

    More info found in Skaffold Docs:
    https://skaffold.dev/docs/environment/image-registries/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search