Pipe command to docker container run via sshd

in flag

I'm setting up an environment for users to log in to a machine via ssh. When logging in a docker container is created on the fly and removed when the user logs out.

This works like a charm interactively but you can't send a command like ssh -p 222 "echo bla" to it. All you get is a the input device is not a TTY

The current configuration is:


Match Group *
    forceCommand sudo /usr/local/bin/



UID=`id -u`
GID=`id -g`

HOME=`getent passwd $USER | cut -d: -f6`

/usr/bin/docker run --rm -w /home/$USER -v $HOME:/home/$USER \
         -v /run/mysqld/mysqld.sock:/run/mysqld/mysqld.sock \
         --mount type=tmpfs,destination=/tmp,tmpfs-size=10240000,tmpfs-mode=1777 \
         --user $UID:$GID -ti localregistry/shell_custom:0.5

The Dockerfile for the shell_custom container is trivial:

FROM alpine:latest

RUN apk add --no-cache bash && \
    apk add --no-cache mysql-client

COPY bashrc /etc/profile

CMD ["/bin/bash", "--rcfile", "/etc/profile"]

Now how do I get around the "the input device is not a TTY" issue? Any hint?



djdomi avatar
za flag
maybe you can take a look into [this](

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.