본문 바로가기
Hello World/Troubleshooting

[Android] Build sandboxing disabled due to nsjail error. This may become fatal in the future.

by Run DaramG 2021. 1. 20.

docker 환경에서 안드로이드 빌드시 아래와 같은 nsjail 관련 에러가 발생 (android 10 Q)

 

에러

Build sandboxing disabled due to nsjail error. This may become fatal in the future.

 

원인

docker 환경에서는 보안 security 관련 환경이 달라서 error가 발생하는 것으로 보임.

기본적으로 도커 컨테이너는 Unprivileged 로 실행되는데, 이 모드에서는 시스템 자원에 접근할 수 없다.

 

 

해결방법

시스템 내 장치 등 주요 자원에 접근하기 위해서는 컨테이너를 privileged 모드로 실행해주어야 하는데, docker run 시 --previleged 옵션을 주면 된다. 그렇게되면 커널의 기능을 대부분 사용할 수 있다.

 

 

참고

아래 ticket에 보면 docker 버전에 따라서 option 이 다른 것 같은데, 확인해봐야한다.

issuetracker.google.com/issues/123210688

I can confirm that with docker 19.03 or later, using --security-opt apparmor=unconfined --security-opt seccomp=unconfined --security-opt systempaths=unconfined works instead of --privileged (the patch in #10 was submitted). Still turning off a lot of security, but better than before if you still wanted to run nsjail.

댓글