Docker Community Forums

Share and learn in the Docker community.

Docker image won't run with -t

(Szeck87) #1

This is a semi-continuation of a question I asked on Stack Overflow. I’m trying to build and run a Docker image that can be installed and used via whalebrew. After getting through the first two problems, I’m now stuck as to why it doesn’t run when installed through whalebrew. From what I understand, whalebrew runs Docker images/packages as a shell script starting with docker run -it and several things after that. So I tried running the image with just docker run -it <image name> --version, nothing happened. I then tried just doing docker run <image name> --version and another with just -i, both of which outputted the version name I expected. So my guess is the whalebrew install run doesn’t work because it also doesn’t work with a regular run with the -t.

If you build the below Dockerfile and run it with docker run -it <image name> --version, it won’t do anything. But remove -it from the run and it should output 1.6.0. Any thoughts why this occurs?

Dockerfile (I purposely put spaces in a few spots to remove auto-links)

FROM ocaml/opam

SHELL ["/bin/sh", “-lc”]
LABEL io.whalebrew .name 'ocp-indent’
LABEL io.whalebrew.config.working_dir '/workdir’
WORKDIR /workdir

RUN opam init --auto-setup
RUN opam install --yes ocp-indent
RUN ocp-indent --help

COPY docker-entrypoint .sh /
CMD ["–help"]

#!/bin/sh -l
ocp-indent “$@”

(Sam) #2

looks like ocp-indent will format the content of the file passed as the argument, unless --version (or some other specific parm is passed)…

looks like ocp-indent has a problem with the console as a tty.