Docker Edit File in Container
First of all, don't do this. It's frown upon and in a way, it makes sense since it kinda defeats the purpose of docker to begin with.
However, there might be situations in which is justified and then this will come handy.
cat .tmp/default.db | docker exec -it postman_postman_1 bash -c 'cat > /opt/postman/.tmp/default.db
If you happen to get the following error:
cannot enable tty mode on non tty input
Just remove the t
flag from docker exec -it
:
cat .tmp/default.db | docker exec -i postman_postman_1 bash -c 'cat > /opt/postman/.tmp/default.db