It should be possible to use nvcc without a GPU.
The error message might be raised, if your NVIDIA driver or local CUDA toolkit isn’t properly installed or found. Did you execute the docker container via nvidia-docker or with the --gpus=all option?