简体   繁体   中英

Get root access inside mssql docker container

I created a MSSQL docker container based on the official image provided by Microsoft ( https://hub.docker.com/_/microsoft-mssql-server ).

I started a bash shell inside the running container and tried to delete some files.

sudo docker exec -it sql1 "bash"

Inside the container it is using the mssql account (by default).

And there seems to be some permission issues when I tried to delete the files.

rm -f *.csv
rm: cannot remove 'xxx.csv': Operation not permitted

How can I obtain the root permission to delete the file? I am not sure what default password I can use to run rm as root.

Thanks a lot!

You can specify the user as an argument:

sudo docker exec -it --user root sql1 "bash"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM