Docker – Setup

I am drafting the step-by-steps to install Docker in this post.

VM Setup

I created a new Ubuntu VM 16.04 in my Xen Server with manual network setup. Hence I have given a static IP to this new VM.

I Installed the xentools using the following commands. This is not required if you do not want to install it.


sudo mount /dev/dvd /media
sudo /media/pandian/XenServer\ Tools/Linux/install.sh

 

After successful installation of xentools, a reboot of VM is required.

Install SSH demon.


sudo apt update

sudo apt upgrade

sudo apt-get install openssh-server

sudo apt-get install curl

 

Add the GPG of docker repository.


curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

 

Add Docker repository to ubuntu sources and install Docker from docker repo, instead of default ubuntu repo.


sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

sudo apt-get update

apt-cache policy docker-ce

sudo apt-get install -y docker-ce

sudo systemctl status docker

Docker is now installed and started.

But it needs sudo to run docker command.


$ docker info
Got permission denied while trying to connect to the Docker daemon socket at uniial unix /var/run/docker.sock: connect: permission denied
$ sudo docker info

Hence, add the unix user to docker group to avoid it. Here is how we shall do it. Credit goes to digitalocean.


~$ sudo usermod -aG docker ${USER}
~$ su - ${USER}
Password:
~$ id -nG
pandian adm cdrom sudo dip plugdev lpadmin sambashare docker

$ id
uid=1000(pandian) gid=1000(pandian) groups=1000(pandian),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare),999(docker)

So the user has been added to docker group. id confirms the same. Now it is the time to run our first hello-world container. As we do not have this image locally, it is downloaded from docker repository.


~$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9db2ca6ccae0: Pull complete
Digest: sha256:4b8ff392a12ed9ea17784bd3c9a8b1fa3299cac44aca35a85c90c5e3c7afacdc
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/

 

 

 

Advertisements

Connect to Office 365 email, Calendar & Lync 2013 from Ubuntu 14

I have installed Ubuntu 14.04 LTS on a laptop. I was wondering how to connect to my Office365 account. Here you go!

Thailand Dance!

Emails:

Use your thunderbird to connect to the following IMAP server

Server name: outlook.office365.com
Port: 993
Encryption method: SSL

Calendar

Install Lightning plugin for thunderbird from the following location.

https://addons.mozilla.org/en-US/thunderbird/addon/lightning/

Install the thunderbird plugin for Exchange Servers from the following location

http://www.1st-setup.nl/wordpress/?page_id=551

I’ve used the latest beta version.

Outlook 365 Addressbook

The thunderbird addon downloaded from the 1st-setup site given above works!

Lync 2013

Pidgin IM client comes by default in Ubuntu. Install the following plugin for Pidgin from the Ubuntu Software Center.

“Pidgin plugin for MS Office Communicator and MS Lync”

Add a “Office Communicator” account.

Basic Tab

Username: pandian@grassfield.org

Login:pandian@grassfield.org

Password: xxxxx

Advanced Tab

Server [port]: leave this as blank

Connection Type: SSL/TLS

User Agent: UCCAPI/15.0.4420.1017 OC/15.0.4420.1017 (Microsoft Lync)

Authentication Scheme: TLS-DSK

Leave the rest.

Good Luck!

Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’

Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2002): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /var/www/egmonitor/index.php on line 11

The socket file is not found on the default /tmp folder in ubuntu. Rather, it was placed inside /var/run/mysqld/mysqld.sock

You can get this from /etc/mysql/my.cnf file

http://www.tech-recipes.com/rx/762/solve-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock/

Reset mysql root password

Sharing the root password is a suicide, somebody changed the password today 😦
Here are the steps to reset it.

Ref: http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

I will explain the steps in ubuntu!

 

UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;

login as the user, who is running mysql

Generally the username would be mysql.

$su
#su - mysql
$

Stop the mysql service

$service mysql stop

Create a new file with the following contents

UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;

you need to execute this commands using safemode

root@ubuntu250:/var/lib/mysql# mysqld_safe --init-file=mysqlpasswd &

You will see the server is starting as below

[1] 2901
root@ubuntu250:/var/lib/mysql# 120106 21:35:48 mysqld_safe Logging to syslog.
120106 21:35:48 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

login now with the new password. it should work now.