Do you need to run containers whose images are not available in a container registry? Here’s how…
Make sure you have the image available as a tar file. Here’s how to save one from a machine with docker:
docker save repository/image --output ./image.tar
Copy the tarfile to the target machine and run this command to load image into containerd:
sudo ctr -n k8s.io images import image.tar
To use this image in a Kubernetes deployment, make sure its marked as never pull:
kind: Deployment
apiVersion: apps/v1
metadata:
name: my-app
labels:
app: my-app
spec:
replicas: 1
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app
image: xxxxx/my-app
imagePullPolicy: Never