Answer a question

I need to install simple packages such as curl inside a running container but I face this error:

~ $ apk add curl
ERROR: Unable to lock database: Permission denied
ERROR: Failed to open apk database: Permission denied

I know how to chnage the user in a Dockerfile but I don't have access to the docker file and I need to do it while I am inside the container or when opening a terminal inside the container. I tried to use --user= but didn't work:

kubectl exec -n kube-system --user="root" -it tiller-deploy-75f6c87b87-xtpxl /bin/ash
error: auth info "root" does not exist

How I can get root access or install curl?

Answers

Is your user sudoer? Run this command:

sudo apk add curl

And if the above command didn't work, run this command.

docker exec -it CONTAINER_NAME apk add curl
Logo

云原生社区为您提供最前沿的新闻资讯和知识内容

更多推荐