Reputation: 650
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.
Upvotes: 3
Views: 661
Reputation: 1
skaffold by default tries to retrieve image from docker hub. If you are ok with getting the image from docker hub just add this config to your skaffold.yaml file but make sure to push your image to docker hub for this to work
build:
local:
push: true
If you don't want skaffold to retrieve image from docker hub and want to do it locally. Install minikube and run minikube start from your terminal and change the config of your skaffold.yaml to
build:
local:
push: false
After changing the skaffold.yaml file, Run skaffold dev It should probably fix your error.
Upvotes: 0
Reputation: 1899
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/
Upvotes: 1
Reputation: 4814
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.
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
Upvotes: 2
Reputation: 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
Upvotes: 0