docker-machine error with virtualbox: server misbehaving

I am running docker-machine on my Arch Linux laptop and when creating new virtualbox docker-machine by:

$ docker-machine create \ 
    --driver virtualbox \ 
    --virtualbox-cpu-count 2 \
    --virtualbox-memory 2048 pipeline

I had then problems with pulling new containers (and probably accessing internet in general) from the inside of the machine, e.g.:

$ docker-compose -f docker-compose.yml build
Building common_folder  
Step 1 : FROM busybox  
Pulling repository docker.io/library/busybox  
ERROR: Service 'common_folder' failed to build:  
Error while pulling image:  
Get https://index.docker.io/v1/repositories/library/busybox/images:  
dial tcp: lookup index.docker.io on 10.0.2.3:53: server misbehaving  

The port 53 and weird address 10.0.2.3 gave me a hint that it is about DNS and that lead to resolve.conf. So I ssh inside the machine:

$ docker-machine ssh pipeline                                                 

and run

sudo echo "nameserver 8.8.8.8" > /etc/resolv.conf  
ping google.com # test the connection  

and then it worked!