O'Reilly logo

Docker and Kubernetes for Java Developers by Jaroslaw Krochmalski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Foreground

In the foreground mode, the console you are using to execute docker run will be attached to standard input, output, and error streams. This is the default; Docker will attach STDIN, STDOUT and STDERR streams to your shell console. If you need to, you can change this behavior and use the -a switch for the docker run command. As a parameter for the -a switch, you use the name of the stream you want to attach to the console. For example:

$ docker run -a stdin -a stdout -i -t centos /bin/bash  

The preceding command will attach both stdin and stdout streams to your console.

The useful docker run options are the -i or --interactive (for keeping STDIN stream open, even if not attached) and -t or -tty (for attaching a pseudo-tty) switches, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required