Skip to main content

Posts

Showing posts from April 9, 2017

The Linux Command Line

Linux Command Line The Linux command line provides a way to manually interact with the Linux operating system. The shell program is a program that acts as an interface between the user and the rest of the Linux operating system, including the kernel. The shell displays the shell promp t. Users enter commands at this prompt. By default, the shell display one of two prompts, depending on the type of user logged in. For root users, the prompt is the # symbol:   For non-root users, the prompt is the $ symbol:   The shell accepts the commands and processes it. The Linux command line refers to commands entered at the shell prompt. The command line ends when you hit the Enter key. A command line however can be extended beyond a single line. I.e. if the command line is longer than one line, you can use the backslash to extend the command line to two or more lines, e.g. sudo

Docker: Deprecated Features

Deprecated Features Periodically, existing Docker features may be removed or replaced with newer features. Features to be removed/replaced are marked as deprecated in Docker documentation. Deprecated features will remain available in Docker for at least three stable releases (roughly 9 months). Users are expected to migrate away from deprecated features as soon as possible and within the deprecation time-frame. References: Deprecated Features page . Licensed under a Creative Commons Attribution 4.0 International License .

Docker: Combine Options

Combining options Multiple single-character command line options, particularly if they do not require an argument, can be combined. For example, rather than typing: docker run -i -t --name test busybox sh ,  you can use: docker run -it --name test busybox sh References: https://docs.docker.com/engine/reference/commandline/cli/#option-types Licensed under a Creative Commons Attribution 4.0 International License .

Docker: Getting Help

Getting help To get help with Docker at the command line, simply append the --help option to the command line: docker --help docker <command> --help Note: If you enter an incomplete command, Docker will usually display a condensed syntax for that command Licensed under a Creative Commons Attribution 4.0 International License .

Docker and Sudo

Docker and Sudo Docker is a privileged command that only the root or system administrator can run. In order to use docker, you have to be root or a superuser . However, from a security point of view it's best practice to login in as a non-root user and elevate your privileges to root only when needed to administer the system. The sudo command allows a non-root user to run commands reserved only for root . Depending on your Docker host configuration, you may be required to prepend docker commands with sudo : To avoid this, particularly in a non-production environment, add a user to the docker group. Users that are part of the docker group can use docker without having to prepend sudo . E.g. edit the /etc/group file and a update the line: docker:x:999: to docker:x:999:user where user is the username of a user on the system. To add multiple users delimit each name with a comma. Docker can then be run without prepending sudo.

Docker Command Line Syntax

Docker Command Line Syntax docker A self-sufficient runtime for containers Usage: docker COMMAND [OPTIONS] [arg...] docker [ --help | -v | --version ] docker-machine Create and manage machines running Docker Usage: $ docker-machine [OPTIONS] COMMAND [arg…] docker-compose Define and run multi-container applications with Docker Usage: $ docker-compose [-f <arg>...] [options] [COMMAND] [ARGS…] $ docker-compose -h|--help Licensed under a Creative Commons Attribution 4.0 International License .

Docker Command Line

Docker Command Line Note: multiple short-form command line options without arguments can be combine, e.g. instead of specifying -i and -t separately, they can be combined under a single dash, as in, -it . Licensed under a Creative Commons Attribution 4.0 International License .

Docker Command Line: Real-world Question

Docker Command Line: Real-world Question Some time ago a user posted this question on the Google Docker Group . He had inherited a Docker platform and wanted to know what the following command line did: $ sudo docker run -v /home/user1/foo:/home/user2/src -v /projects/foo:/home/user2/data  \ -p 127.0.0.1:40180:80 -p 127.0.0.1:48000:8000 -p 45820:5820 -t -i user2/foo bash Let's take each command line parameter in turn: Parameter Description sudo used to run docker as the super user if not previously setup docker run docker run command -v <host path>:<container path> maps a host volume into a container -p <hostIP>:<hostPORT>:<containerPORT> binds a container port to a host port from a specific host IP -p <hostPORT>:<containerPORT> binds a container port to a host por