Reputation: 391
Is there any way to access local docker images directly (without using 'docker save') with k3s?
Like minikube accesses local docker images after running this command
eval $(minikube docker-env)
A little bit of background.
I have set up a machine using Ubuntu 19.04 as 'master' and raspberry pi as 'worker' using k3s. Now, I want to use a local image to create a deployment on the worker node.
Update
Adding screenshot as said in the comment below.
Screenshot for the image listings
Upvotes: 29
Views: 26391
Reputation: 31
In k3s the docker engine is missing, you can load new container images using the k3s ctr command.
First load the docker image as tar file, then use k3s ctr image import command
For example: k3s ctr images import [image tar]
Upvotes: 2
Reputation: 524
While this doesn't make all Docker images available,, a useful work-around is to export local Docker images and import them to your ctr
:
docker save my/local-image:v1.2.3 | sudo k3s ctr images import -
This will make them available on-demand to your k3s cluster.
This is useful for users who cannot get k3s server
to work with the --docker
flag.
Upvotes: 20
Reputation: 664
You can start k3s like this sudo k3s server --docker
which will use host's Docker rather than containerd. This will make all local images available to k3s and if your ImagePullPolicy is IfNotPresent k3s will use it rather than trying to pull it.
Upvotes: 15