<\/span><\/h2>\nConnect to your server via SSH as the root user using the following command:<\/p>\n
ssh root@IP_ADDRESS -p PORT_NUMBER<\/pre>\nand replace \u201cIP_ADDRESS<\/span>\u201d and \u201cPORT_NUMBER<\/span>\u201d with your actual server IP address and SSH port number.<\/p>\nBefore starting with the installation, you will need to update your system packages to their latest versions.<\/p>\n
You can do this by running the following command:<\/p>\n
sudo yum update<\/pre>\nOnce the update is completed, we can move onto the installation step.<\/p>\n
<\/span>Step 2: Install Docker on CentOS 7<\/span><\/span><\/h2>\nThe recommended way to install Docker is to install from the Docker repositories. We will install some required dependencies with the following command:<\/p>\n
sudo yum install yum-utils device-mapper-persistent-data lvm2<\/pre>\nNext, we will add the Docker repository, enable it, and install it with the following commands:<\/p>\n
sudo yum-config-manager --add-repo https:\/\/download.docker.com\/linux\/centos\/docker-ce.repo<\/span>\r\nsudo yum install docker-ce<\/pre>\nAfter the installation has completed, we will start the Docker daemon:<\/p>\n
sudo systemctl start docker<\/pre>\nWe can verify that it\u2019s running with the following command:<\/p>\n
sudo systemctl status docker<\/pre>\nThe output should be similar to the following:<\/p>\n
docker.service - Docker Application Container Engine\r\n\u00a0 \u00a0 \u00a0 \u00a0Loaded: loaded (\/lib\/systemd\/system\/docker.service; enabled; vendor preset: enabled)\r\n\u00a0 \u00a0 \u00a0 \u00a0Active: active (running) \r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Docs: https:\/\/docs.docker.com<\/span>\r\nMain PID: 4234 (dockerd)\r\n\u00a0 \u00a0 \u00a0 \u00a0Tasks: 8\r\n\u00a0 \u00a0 CGroup: \/system.slice\/docker.service<\/span>\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u2514\u25004234 \/usr\/bin\/dockerd -H fd:\/\/ --containerd=\/run\/containerd\/containerd.sock<\/span><\/pre>\nDocker has now been successfully installed. In the next steps, we will show you how to use the\u00a0docker\u00a0command.<\/p>\n
<\/span>Step 3: Using the Docker Command<\/span><\/span><\/h2>\nThe syntax of the Docker CLI command takes this form:<\/p>\n
docker [option] [command] [arguments]<\/pre>\nTo list all available commands, we need to run the docker command with no parameters:<\/p>\n
docker<\/pre>\nThe output should be similar to the following:<\/p>\n
A self-sufficient runtime for containers\r\n\r\nOptions:\r\n--config string Location of client config files (default \"\/root\/.docker\")\r\n-D, --debug Enable debug mode\r\n-H, --host list Daemon socket(s) to connect to\r\n-l, --log-level string Set the logging level (\"debug\"|\"info\"|\"warn\"|\"error\"|\"fatal\") (default \"info\")\r\n--tls Use TLS; implied by --tlsverify\r\n--tlscacert string Trust certs signed only by this CA (default \"\/root\/.docker\/ca.pem<\/span>\")\r\n--tlscert string Path to TLS certificate file (default \"\/root\/.docker\/cert.pem<\/span>\")\r\n--tlskey string Path to TLS key file (default \"\/root\/.docker\/key.pem<\/span>\")\r\n--tlsverify Use TLS and verify the remote\r\n-v, --version Print version information and quit\r\n\r\nManagement Commands:\r\nbuilder Manage builds\r\nconfig Manage Docker configs\r\ncontainer Manage containers\r\nengine Manage the docker engine\r\nimage Manage images\r\nnetwork Manage networks\r\nnode Manage Swarm nodes\r\nplugin Manage plugins\r\nsecret Manage Docker secrets\r\nservice Manage services\r\nstack Manage Docker stacks\r\nswarm Manage Swarm\r\nsystem Manage Docker\r\ntrust Manage trust on Docker images\r\nvolume Manage volumes\r\n\r\nCommands:\r\n\u00a0 attach Attach local standard input, output, and error streams to a running container\r\n build Build an image from a Dockerfile\r\n commit Create a new image from a container's changes\r\n cp Copy files\/folders between a container and the local filesystem\r\n create Create a new container\r\n diff Inspect changes to files or directories on a container's filesystem\r\n events Get real time events from the server\r\n exec Run a command in a running container\r\n export Export a container's filesystem as a tar archive\r\n history Show the history of an image\r\n images List images\r\n import Import the contents from a tarball to create a filesystem image\r\n info Display system-wide information\r\n inspect Return low-level information on Docker objects\r\n kill Kill one or more running containers\r\n load Load an image from a tar archive or STDIN\r\n login Log in to a Docker registry\r\n logout Log out from a Docker registry\r\n logs Fetch the logs of a container\r\n pause Pause all processes within one or more containers\r\n port List port mappings or a specific mapping for the container\r\n ps List containers\r\n pull Pull an image or a repository from a registry\r\n push Push an image or a repository to a registry\r\n rename Rename a container\r\n restart Restart one or more containers\r\n rm Remove one or more containers\r\n rmi Remove one or more images\r\n run Run a command in a new container\r\n save Save one or more images to a tar archive (streamed to STDOUT by default)\r\n search Search the Docker Hub for images\r\n start Start one or more stopped containers\r\n stats Display a live stream of container(s) resource usage statistics\r\n stop Stop one or more running containers\r\n tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE\r\n top Display the running processes of a container\r\n unpause Unpause all processes within one or more containers\r\n update Update configuration of one or more containers\r\n version Show the Docker version information\r\n wait Block until one or more containers stop, then print their exit codes<\/pre>\nTo see the options available to a specific command, execute the following command:<\/p>\n
docker docker-subcommand<\/span><\/em> --help<\/pre>\nTo view information about Docker:<\/p>\n
docker info<\/pre>\n