Add user_init_command config option, to specify an additional command that should be run when the container is created.
This commit is contained in:
parent
9340dbe720
commit
488dedb74e
@ -245,7 +245,8 @@ config = {
|
||||
"command_env": {},
|
||||
"cwd": os.getcwd(),
|
||||
"tty": sys.stdout.isatty(),
|
||||
"log": log
|
||||
"log": log,
|
||||
"user_init_command": []
|
||||
}
|
||||
|
||||
# load config from files
|
||||
@ -336,5 +337,11 @@ except Exception:
|
||||
log("Creating container user: {}", user)
|
||||
docker_create_user(container_name, user, uid)
|
||||
|
||||
if config['user_init_command']:
|
||||
user_init_command = config['user_init_command']
|
||||
if isinstance(user_init_command, str):
|
||||
user_init_command = ["sh", "-c", user_init_command]
|
||||
docker_exec(container_name, user_init_command, command_user, command_env, tty, "/home/{}".format(command_user))
|
||||
|
||||
log("Welcome to {} (IP {})", container_name, container['NetworkSettings']['IPAddress'])
|
||||
docker_exec(container_name, command, command_user, command_env, tty, command_workdir)
|
||||
|
Loading…
x
Reference in New Issue
Block a user