Docker – cp

Docker cp command Docker cp command is used to copy files between docker host system and container machine. This will work even the docker container is not running. Syntax: docker cp [OPTIONS] SRC_PATH DEST_PATH Copy File from Container to Host Copy a file /opt/testfile.txt from container id 043869c58300 to host machine /tmp directory. use following example. $ docker cp 043869c58300:/opt/testfile.txt /tmp You can also use container name instead of container ID. Copy File from Host to Container Also, copy a file /opt/newfile.txt from host system to container ( id 043869c58300)…

Read More

Docker – run

Docker run command Use Docker run command to launch containers from an image. It provides a large number of options. Syntax docker run [OPTIONS] IMAGE [COMMAND] [ARG…] Example For example, run the hello-world example officially provided by Docker community to test your installation. Run command will also download the image from docker hub it not found locally. $ sudo docker run hello-world As a better use, you can use -i to keep STDIN open and -t to allocate a TTY to the container. You can also use -d to run…

Read More

Docker – ps

Docker ps command Use ps command to list the docker containers on your local system. Syntax docker ps [OPTIONS] Example To list all running container use the following command. $ docker ps Docker ps Options #1. List All (-a, –all) Use this switch to show all containers created on local system, either they are in any state. $ docker ps -a #2. Show ID Only (-q, –quiet) This option will only display the numeric id only of the container. $ docker ps -q #3. Show Size (-s, –size) This option…

Read More

Docker – build

Docker build command Docker build command is used to build an image from a Dockerfile. For more details visit our Dockerfile and Dockerfile directives tutorial. Syntax docker build [OPTIONS] [Dockerfile PATH|URL] Example Let’s create an example Dockerfile in your current directory. vim Dockerfile and add the following content.

Now build the image using single dot “.”, as Dockerfile is available in the current directory. Also, use -t image_name to specify tag name to the image. docker build -t apache_ubuntu . The build command will pull the image “tecadmin/ubuntu-ssh:16.04” from…

Read More

Docker – Compose Example

Docker Compose Example This is the step by step tutorial to understand uses of Docker compose. In this tutorial, I will create two Docker containers using Docker compose. One docker container will have MySQL database instance and another Docker container have Apache web server with our dummy application file. Let’s follow step by step tutorial and watch the things happening there. Step 1 – Create Directory Structure First of all, create a directory structure. Here webapp is our web application directory. Also, create a index.html in webapp directory for testing.…

Read More

Docker – Introduction

Docker Introduction Docker is a software container platform. It is an open platform for developing, shipping, and running applications. A Docker container wraps all the software components to run an application. Using Docker you can provide an isolated environment for your every individual application. Docker Engine “Docker Engine” is the core of Docker which creates, ship and runs Docker containers. Docker Engine provides client-server application architecture with the following major components. A server daemon process for continuous running. The REST API to talk to the daemon and send instruction to…

Read More

Docker – Compose

Docker Compose Docker Compose is another best tool for docker to setup multi-container environments. Using this create a single compose file with defining all the containers with there environments. You can easily use single command to build images and run all the containers. There is the three-step process to work with Docker Compose. 1. Define application environment with Dockerfile for all services. 2. Create a docker-compose.yml file defining with all services under application. 3. Run docker-compose up to run all services under applications. You must have Docker Engine installed on…

Read More

Docker – Networking Example

Docker Networking Example As you already read our previous tutorial Docker Networking. This tutorial, we will create a small docker network with 2 docker containers as following. > MySQL – A relational database server. > PHPMyAdmin – A web based interface to manage MySQL server. In this tutorial, you will learn how to access MySQL server using PHPMyAdmin running on the different container. 1. Create Network First of all, create a new docker network. Use below command to create new bridge network named my-bridge-network. $ docker network create -d bridge…

Read More

Docker – Networking

Docker Networking Docker provides an option to create and manage there own network for networking between docker containers. Use docker network subcommand to manage the Docker networking. Syntax: docker network [options] Use below tutorial to create, list and manage Docker networking. List Docker Networks Use ls option with docker network command to list currently available network on the docker host. docker network ls Create Docker Network Docker provides multiple types of network. Below command will create a bridge network on your system. Syntax: docker network create -d [network_type] [network_name] Example:…

Read More

Docker – Installation

Docker Installation We have prepared tutorials for advance docker installation. Use links to get access for docker installation. > Install Docker on CentOS, RedHat & Fedora > Install Docker on Ubuntu & Debian To install docker from default repositories follow this tutorial. #1. Requirements Docker required 64-bit operating system with Kernel >= 3.10. Older versions of Kernel have some missing requirements to run all features of Docker. $ uname -r 4.4.0-92-generic #2. Install Docker Docker is available under default repositories of Latest Linux systems. You simply install them using package…

Read More