Docker exec in docker windows

10,068

Solution 1

I found out that using " instead of ' fixes this:

docker exec -t sandbox /bin/sh -c "echo '127.0.0.1 sandbox' >> /etc/hosts" 

Solution 2

instead of
docker exec -it [containerid] /bin/sh

try to use
docker exec -it [containerid] //bin//sh

Share:
10,068
Admin
Author by

Admin

Updated on June 21, 2022

Comments

  • Admin
    Admin almost 2 years

    I'm having trouble with running

     `docker `exec -t sandbox /bin/sh -c 'echo "127.0.0.1 sandbox" >> /etc/hosts' 
    

    in windows docker. I keep getting the following error:

    "The system cannot find the path specified"
    

    Does anyone know why I am getting the error?