Docker is a set of platform as a service products that use OS-level virtualisation to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.
A Highly Reliable, Low-Cost Way To Build, Ship, & Run Distributed Apps At Any Scale. Docker Provides Simple Commands You Can Use To Build, Start, Or Stop Containers.
Step 1: Update Software Repositories
It’s a good idea to update the local database of software to make sure you’ve got access to the latest revisions.
Open a terminal window and type:
sudo apt-get update
Allow the operation to complete.
Step 2: Uninstall Old Versions of Docker
Next, it’s recommended to uninstall any old Docker software before proceeding.
Use the command:
sudo apt-get remove docker docker-engine docker.io
Step 3: Install Docker on Ubuntu 18.04
To install Docker on Ubuntu, in the terminal window enter the command:
sudo apt install docker.io
Step 4: Start and Automate Docker
The Docker service needs to be setup to run at startup. To do so, type in each command followed by enter:
sudo systemctl start docker
sudo systemctl enable docker
enable docker command, in terminal
Step 5 (Optional): Check Docker Version
To verify the installed Docker version number, enter:
docker –version
Other commands
sudo systemctl stop apache2 – We need to stop systeam apache to run properly apache in docker.
docker-compose stop
docker-compose rm
docker-compose up
docker-compose up -d
To up only database:
docker-compose up db
To run shell script like run apt get install or apache command
sudo docker-compose exec apache bash