codingstory
codingstory

Reputation: 21

How to write a Linux command in a Dockerfile

I have a linux shell command, that need to be written in a Dockerfile.

for ((i=10001; i<10101; ++i)); do pwgen -n -s -B -c 10 | sed "s/^/$i /"; done > user.tx_ ; /bin/cp -f user.tx_ user.txt ;

Anybody can help me ? Thank you very much.

Upvotes: 2

Views: 82

Answers (2)

Nir Levy
Nir Levy

Reputation: 12953

You can use the RUN keyword in order to execute stuff.
If it's shell command you want to run, you can run bash -c with your shecl script.

See some examples and doc here:. https://docs.docker.com/engine/reference/builder/#run

Upvotes: 3

Behrooz
Behrooz

Reputation: 1734

This can provide you with a shell inside the container:

docker exec dockernamehere bash

Upvotes: 0

Related Questions