Can't install vim in Docker container

I’m trying to install vim in a Docker container via apt update and apt-get install vim but the first command fails with a permission denied error.

I’m guessing I need to run these commands as root but am not sure how to do so. Any clues appreciated.

Hi @infoarts, welcome to DevKinsta!
Which container are you trying to install vim on? For example this works on the devkinsta_nginx container :

  1. docker exec -it devkinsta_nginx /bin/sh
  2. apk update
  3. apk add vim

If the container has bash installed, you can add -u root to your exec command which might solve your permissions issue:

docker exec -u root -it devkinsta_fpm bash