Take the case where you loaded a docker image from somebody else or from a repository and a user was specified in the dockerfile during the docker image creation. Now, you want to install something in this alpine container and need root privilege to do this.
you can check the user field in the image dockerfile by doing
docker inspect solr:6.6.0-alpine
If the value of the field "user" is something else than empty or root, you won't have root access to the container to install things. Either you can execute something in the existing container as "root" user:
docker exec --user root -it 008d1946ddf8 bash
Or you can generate a new container from the docker image with the root user .
docker run -it --user root solr:6.6.0-alpine
If you commit this new container, the newly generated image will have the "root" user in its dockerfile.
bash-4.3# apk update
bash-4.3# apk add curl