0

I have a docker container running /bin/bash

So I can attach to it and run commands like

docker attach <container id>
bash# apt-get install package

Is there a way I can do this in a single docker command instead, maybe something like this:

docker attach <container id> "apt-get install package"
bwbrowning
  • 6,200
  • 7
  • 31
  • 36

1 Answers1

2

This should work.

echo 'sudo apt-get install package' | docker attach <container id>

study
  • 5,628
  • 4
  • 36
  • 44