https://rancher.com/ logo
Title
i

icy-parrot-30770

06/09/2022, 4:03 PM
hello everyone, I hope you are all well & safe I just switch from "Docker desktop" to "rancher desktop" Version: 1.4.1 on OSX Version 12.4 after several hours in testing, searching on google, i come here to ask you for some help because i am stucked maybe this issue has already been solved somewhere but do not find it I do a basic installation, kubernetes enabled, containerd as runtime, automated path configuration, sudo access allowed I can pull an image via the following command :
nerdctl -n k8s.io pull jupyter/datascience-notebook:python-3.10.4
I can run this basic image :
nerdctl run -p 8888:8888 jupyter/datascience-notebook:python-3.10.4
-> it works fine But if build locally a custom image based on this one :
nerdctl build --namespace k8s.io -t l_jupyter:latest .
based a Dockerfile like : --------------------------- FROM jupyter/datascience-notebook:python-3.10.4 RUN pip3 install --upgrade python-dotenv --------------------------- => the image "l_jupyter:latest" is visible in the "rancher desktop"/preference/images list in the namespace k8s.io and if i try to run this custom image like this :
nerdctl run -p 8888:8888 l_jupyter:latest
OR via a "jupyter.yaml" deployment file like : ---------------------------
apiVersion: apps/v1
kind: Deployment
metadata:
name: jupyter-deployment
namespace: default
labels:
app: jupyter
spec:
replicas: 1
selector:
matchLabels:
app: jupyter
template:
metadata:
labels:
app: jupyter
spec:
containers:
- name: jupyter
image: l_jupyter:latest
imagePullPolicy: Always
....
....
--------------------------- via the command :
kubectl -n default apply -f jupyter.yaml
or
kubectl -n k8s.io apply -f jupyter.yaml
I get the error:
Failed to pull image "l_jupyter:latest": rpc error: code = Unknown desc = Error response from daemon:
pull access denied for l_jupyter, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
I do not understand from where this error come from Do you have any advice to solve it ??
f

fast-garage-66093

06/09/2022, 4:31 PM
Your
nerdctl run
command did not specify the
<http://k8s.io|k8s.io>
namespace, so tries to locate the image in
default
, where it doesn't exist. It works like this:
$ nerdctl -n <http://k8s.io|k8s.io> run -p 8888:8888 l_jupyter:latest
Entered start.sh with args: jupyter lab
Executing the command: jupyter lab
[I 2022-06-09 16:30:13.062 ServerApp] jupyterlab | extension was successfully linked.
👍 1
Your deployment fails because you specify
imagePullPolicy: Always
, which tells kubelet to ignore the local image and pull a copy from dockerhub, where the repository does not exist. You need to change the policy to
Never
for it to use the locally built image.
👍 2
i

icy-parrot-30770

06/09/2022, 8:39 PM
@fast-garage-66093 I have tried to pull in both default & k8s.io without any success but changing "imagePullPolicy" make the trick !! many many many thanks !!!! it is brilliant !!
f

fast-garage-66093

06/09/2022, 10:39 PM
You should actually not use
nerdctl -n <http://k8s.io|k8s.io> run ...
because the namespace is owned by k8s, and kubelet will eventually kill your container because it is not owned by a Pod. So if you want to run the plain container, build and run in the
default
namespace
i

icy-parrot-30770

06/20/2022, 4:14 PM
@fast-garage-66093 sorry for the late response, no issue with k8s namespace up to now... but you are right, as it is recommanded as a best practice to use dedicated namespaces, I changed to use a dedicated one