question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Documentation] Clarification about using locally built images

See original GitHub issue

For feature requests, describe what you’d like to add or change At the present time it’s not clear how to use locally built images (by nerdctl build) in k8s manifests. There is a phrase on main RD site The container images you build can be run by Kubernetes immediately without the need for a registry and no more info about that

To Reproduce

  1. build image nerdctl build -t local/my-app:latest .
  2. Deploy simple manifest:
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: my-app-deployment
      labels:
        app: my-app
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: my-app
      template:
        metadata:
          labels:
            app: my-app
        spec:
          containers:
            - name: my-app
              image: local/my-app:latest
    
    by command:
    kubectl apply -f my-app.yaml
    
  3. Get events
    kubectl get events
    
    See error something like this:
    Failed to pull image "local/my-app:latest": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/local /my-app:latest": failed to resolve reference "docker.io/local/my-app:latest": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
    

Setup (please complete the following information):

  • OS: MacOS Monterey
  • Rancher Desktop version: 0.6.1
  • Kubernetes version: 1.21.6

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:6

github_iconTop GitHub Comments

6reactions
taylorzacommented, Dec 14, 2021

In addition to creating the image in the k8s.io namespace you should also set the imagePullPolicy to Never

1reaction
AkihiroSudacommented, Feb 24, 2022

Please provide definitive steps to use locally built images with nerdctl in K8s manifests.

# nerdctl --namespace k8s.io build -t foo /some-dockerfile-directory
# kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
  name: foo
spec:
  containers:
    - name: foo
      image: foo
      imagePullPolicy: Never
EOF
Read more comments on GitHub >

github_iconTop Results From Across the Web

Best practices for writing Dockerfiles - Docker Documentation
Best practices for writing Dockerfiles. This document covers recommended best practices and methods for building efficient images. Docker builds images ...
Read more >
How to use a local registry - MicroK8s
The following documentation explains how to use MicroK8s with local images, or images fetched from public or private registries. A familiarity with building, ......
Read more >
Build Images with Docker | DevSpace | Documentation
Explanation : The first image backend would be preferably built with Minikube's Docker daemon and the image would not be pushed to a...
Read more >
Pushing and pulling images | Container Registry documentation
To push any local image to Container Registry using Docker or another third-party tool, you need to first tag it with the registry...
Read more >
How to customize Docker images - Amazon EMR
Create a new Dockerfile on your local Workspace. Edit the Dockerfile you just created and add the following content. This Dockerfile uses the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found