shantanuo
shantanuo

Reputation: 32220

save docker output to a text file

I can download the image that has sqlite database built-in.

docker run --rm -it shantanuo/panama sqlite3 panama.sqlite

I get the prompt where I can type sql command and get the results.

sqlite> select * from panama limit 10;

Can I do this without initiating a container? something like this does not work...

echo "select * from panama limit 10;" | docker run --rm shantanuo/panama sqlite3 panama.sqlite > stn.txt

Upvotes: 1

Views: 2080

Answers (1)

Javier Segura
Javier Segura

Reputation: 668

You can get your desired behavior doing that:

docker run --rm shantanuo/panama sqlite3 panama.sqlite "select * from panama limit 10" > stn.txt

Upvotes: 1

Related Questions