https://www.edureka.co/blog/install-docker/
Install : https://www.youtube.com/watch?v=lcQfQRDAMpQ&list=PL9ooVrP1hQOHUKuqGuiWLQoJ-LD25KxI5&index=2
Edureka : https://www.youtube.com/watch?v=h0NCZbHjIpY&list=PL9ooVrP1hQOHUKuqGuiWLQoJ-LD25KxI5
Next : https://www.youtube.com/watch?v=wi-MGFhrad0&list=PLhW3qG5bs-L99pQsZ74f-LC-tOEsBp2rK
=====================================
Docker Install Ubuntu
=====================================
1.First, update your existing list of packages:
sudo apt update
2.Next, install a few prerequisite packages which let apt use packages over HTTPS:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
3.Then add the GPG key for the official Docker repository to your system:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
4.Add the Docker repository to APT sources:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
5.Next, update the package database with the Docker packages from the newly added repo:
sudo apt update
6.Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:
apt-cache policy docker-ce
You'll see output like this, although the version number for Docker may be different:
docker-ce:
Installed: (none)
Candidate: 18.03.1~ce~3-0~ubuntu
Version table:
18.03.1~ce~3-0~ubuntu 500
500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
7.Notice that docker-ce is not installed, but the candidate for installation is from the Docker repository for Ubuntu 18.04 (bionic).So, install Docker:
sudo apt install docker-ce
8.Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it's running:
sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2018-10-01 21:10:48 IST; 3min 39s ago
if not start, start the service by running
sudo service docker start
satya@satya:~/.../docker$ docker --version
Docker version 18.06.1-ce, build e68fc7a
=========================================================
Task 1 : pull centos image from hub.docker
=========================================================
### Pull image from Docker Hub
satya@satya:~/.../docker$ sudo docker pull centos
Using default tag: latest
latest: Pulling from library/centos
256b176beaff: Pull complete
Digest: sha256:6f6d986d425aeabdc3a02cb61c02abb2e78e57357e92417d6d58332856024faf
Status: Downloaded newer image for centos:latest
First, it will check the local registry for CentOS image. If it doesn’t find there, then it will go to the docker hub and pull the image
### Check Downloaded Image
-By Def. location is /var/lib/docker
-In the case of aufs:/var/lib/docker/aufs/diff/<id>
-In the case of devicemapper:/var/lib/docker/devicemapper/devicemapper/data
### Now, Run the CentOS container.
satya@satya:~/.../docker$ sudo docker run -it centos
[root@15458942452c /]#
You logged in centos successfully
================================================
Task 2 : Wordpress + MySQL + PhpMyAdmin
================================================
Basically, you need one container for WordPress and you need one more container as MySQL for back end, that MySQL container should be linked to the wordpress container. We also need one more container for Php Myadmin that will be linked to MySQL database, basically, it is used to access MySQL database.
[ Worpress ]
|
link= wordprees+ MySQL
|
[ MySQL ]
|
link= MySql+ PhpMyAdmin
|
[ PhpMyAdmin ]
Here we will write Docker Compose file to install & make link between them
Steps involved:
-------------------
1. Install Docker Compose:
2. Install WordPress: We’ll be using the official WordPress and MariaDB Docker images.
3. Install MariaDB: MariaDB is a relational database it provides an SQL interface for accessing data.
4. Install PhpMyAdmin: handle the administration of MySQL over the Web.
5. Create The WordPress Site
1. Install Docker Compose
--------------------------------
### Install Python Pip first:
sudo apt-get install python-pip -y
### Now, you can install Docker Compose:
sudo pip install docker-compose
2. Install WordPress:
-------------------------------
### Create a wordpress directory:
mkdir wordpress
cd wordpress/
### In this directory create a Docker Compose YAML file, then edit it using gedit:
sudo gedit docker-compose.yml
--------------------------------------------------------
version: "2"
services:
my-wpdb:
image: mariadb
ports:
- "8081:3306"
environment:
MYSQL_ROOT_PASSWORD: root
my-wp:
image: wordpress
volumes:
- ./:/var/www/html
ports:
- "8080:80"
links:
- my-wpdb:mysql
environment:
WORDPRESS_DB_PASSWORD: root
phpmyadmin:
image: corbinu/docker-phpmyadmin
links:
- my-wpdb:mysql
ports:
- 8181:80
environment:
MYSQL_USERNAME: root
MYSQL_ROOT_PASSWORD: root
--------------------------------------------------------
### Now start the application group:
satya@satya:~/.../Wordpress$ docker-compose up -d
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
this error means you don't have enogh permissions. so run with Sudi
satya@satya:~/.../Wordpress$ sudo docker-compose up -d
### Test wordpress
http://localhost:8080/
### Test PhpMyAdmin
http://localhost:8181/
0 Comments
Post a Comment