Skip to content

Instantly share code, notes, and snippets.

@VishDev12
Last active October 16, 2022 04:51
Show Gist options
  • Select an option

  • Save VishDev12/997c98b28f078dbb05b1ce255bc957c1 to your computer and use it in GitHub Desktop.

Select an option

Save VishDev12/997c98b28f078dbb05b1ce255bc957c1 to your computer and use it in GitHub Desktop.
Uses nerdctl to pull an Image to the machine.
# Install the ECR Credential Helper that automatically authenticates with ECR.
sudo yum install amazon-ecr-credential-helper -y
# Configure Docker to use the credential helper.
mkdir ~/.docker/
cat > ~/.docker/config.json << EOF
{
"credsStore": "ecr-login"
}
EOF
# Download and install nerdctl.
wget https://github.com/containerd/nerdctl/releases/download/v0.23.0/nerdctl-0.23.0-linux-amd64.tar.gz
sudo tar Cxzvf /usr/bin nerdctl-0.23.0-linux-amd64.tar.gz
# containerd is not started when the machine is booted, so start it.
sudo systemctl start containerd
# The images used by Kubernetes with containerd reside in the
# k8s.io namespace, so create that. Not coterminous with
# the concept of a Kubernetes namespace.
sudo nerdctl namespace create k8s.io
# Pull images with nerdctl to the k8s.io namespace.
# Since sudo is used, explicitly specify the location of the
# Docker config file, which nerdctl understands.
sudo DOCKER_CONFIG=/home/ec2-user/.docker/ nerdctl -n k8s.io pull --quiet $IMAGE
# Verify the containerd namespace and the images within it.
# ctr is the containerd CLI.
sudo ctr ns ls
sudo ctr -n k8s.io image ls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment