Skip to content
Advertisement

How to write a bash script which automate entering “docker container” and doing other things?

I want to implement an automatic bash script which enters a running docker container, and do some stuffs:

JavaScript

Executing the script on terminal:

JavaScript

The output shows only login the docker container, but won’t do other operations.

Is there any method to automate entering docker container and doing other things?

Advertisement

Answer

You can use bash -c:

JavaScript

For running a series of commands use here-doc in BASH:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement