user7208544
user7208544

Reputation: 131

Docker exec in docker windows

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?

Upvotes: 9

Views: 21605

Answers (4)

nish8690
nish8690

Reputation: 141

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

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

Upvotes: 13

bsgrmm
bsgrmm

Reputation: 1

I'm using docker exec -it [containerid] /bin/sh

Upvotes: -3

user7208544
user7208544

Reputation: 131

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

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

Upvotes: 4

Joan Miquel
Joan Miquel

Reputation: 286

I'd run docker ps to get the ID of your running container then do docker exec that_id /bin/bash

Upvotes: 1

Related Questions