0

Installing Docker on VMware Fusion

If you want to Test, R&D with Docker then you can install it on VMWare Fusion box.

There are some pre-requisites for installing Docker.
1. VMware Fusion
2. Ubuntu or CentOS ( i will use Ubuntu )
3. Laptop/Desktop ( x64 )
4. Internet Connection

 

First Download the VMware Fusion and install it.
Second Download the Ubuntu from internet. Server version it could be 14.x or 16.x

After download Open Fusion and create new VM with Ubuntu OS


And follow the steps.

Final step is to attach the Ubuntu CD

Now Power On the Virtual machine and start insttaling Ubuntu first

1. Select the Language
2. Select the install ubuntu Server

3. Select the location, language and keyboard prefered langauge.

4. It will ask you to configure the keyboard select No and follow the instruction

5. it will start loading the component from CD.

6. Configure the network

7. Set up User name and password


8. It will Give you warrning that your password is not as per the policy will you continue or discard.

9. it will ask you for Partition select set up with LVM

10. You can choose the disk size in % as well like 80% or 70%.

11. It will ask you to install GRUB

12. Now installation is Finished and you are ready to install Docker.

 

Now time to install Docker.

1. Open the ubuntu console and check the version.

2. Now Run the Command: apt-get update

3. Now Run the Command: apt-get install -y docker.io
and follow the instruction while installing like Press Y for Yes

4. After installing check the Docker Version: docker version

5. Need to Add two URL for depot to be download, URL mentioned in below screenshot.

6. Now try to install: lxc-docker

But while installing i am getting Error. also getting error while checking docker version.
Error1: cannot connect to the Docker daemon. Is docker daemon running on this host?
Erro2:docker.service is masked

to resolve this issue you have to run some command.
# systemctl unmask docker.socket
# systemctl unmask docker.service
# systemctl start docker.service

it will resolve this issue.

0

How to install Docker toolbar

If you are familier with VMWare Hypervisor then you can easily able to compare and understand Docker.Today we will see

1. How to install docker in (MACBOOK)
2. How to Create a Docker Container VM
3. How to Access Nginx

First you have to download the the Docker Toolbar. ( Link to download )

After downloading Docker toolbox open the file.

1. It will start installation Page


2. Click on Continue. After that it will give you Overview.

Here you can select the check box Help Docker improve Toolbox.

3. Select the location where you want to install the Docker.

If you have Multiple Drive then select the same. and provide the password for laptop.


4. Now it’s time to click on Docker Quickstart Terminal.

it will install the Virtual box


5. It will open the Terminal.


6. Kitematic (Beta). Here you can login with Docker ID


7. Finally Finish the installation.


Check the Docker Help
1. Open Terminal and type the command:

Shaswatis-MacBook-Pro:~ shaswati$ docker
Usage: docker [OPTIONS] COMMAND [arg…]
docker [ –help | -v | –version ]

A self-sufficient runtime for containers.

Options:

–config=~/.docker Location of client config files
-D, –debug Enable debug mode
-H, –host=[] Daemon socket(s) to connect to
-h, –help Print usage
-l, –log-level=info Set the logging level
–tls Use TLS; implied by –tlsverify
–tlscacert=~/.docker/machine/machines/default/ca.pem Trust certs signed only by this CA
–tlscert=~/.docker/machine/machines/default/cert.pem Path to TLS certificate file
–tlskey=~/.docker/machine/machines/default/key.pem Path to TLS key file
–tlsverify=true Use TLS and verify the remote
-v, –version Print version information and quit

Commands:
attach Attach to a running container
build Build an image from a Dockerfile
commit Create a new image from a container’s changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes on a container’s filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container’s filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on a container or image
kill Kill a running container
load Load an image from a tar archive or STDIN
login Log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
network Manage Docker networks
pause Pause all processes within a container
port List port mappings or a specific mapping for the CONTAINER
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart a container
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save one or more images to a tar archive
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop a running container
tag Tag an image into a repository
top Display the running processes of a container
unpause Unpause all processes within a container
update Update configuration of one or more containers
version Show the Docker version information
volume Manage Docker volumes
wait Block until a container stops, then print its exit code

Run ‘docker COMMAND –help’ for more information on a command.

2. bash-3.2$ docker run hello-world

#Unable to find image ‘hello-world:latest’ locally
#latest: Pulling from library/hello-world
#4276590986f6: Pull complete
#a3ed95caeb02: Pull complete
#Digest:sha256:4f32210e234b4ad5cac92efacc0a3d602b02476c754f13d517e1ada048e5a8a
#Status: Downloaded newer image for hello-world:latest

3.
=========================================================

Creating New Docker VM
=========================================================

bash-3.2$ docker-machine create –driver virtualbox Dtechinspiration

Here
Dtechinspiration is Docker VM
Virtualbox is Software in which this Docker VM created


You Can see the Console for this Docker VM.


Now After Docker VM creation check the list by using below command.

4.
=========================================================
List of Docker VM
=========================================================
bash-3.2$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.11.1
Dtechinspiration – virtualbox Running tcp://192.168.99.101:2376 v1.11.1

5.
=========================================================
Set default docker vm
=========================================================
bash-3.2$ docker-machine env dtechinspiration
export DOCKER_TLS_VERIFY=“1”
export DOCKER_HOST=“tcp://192.168.99.101:2376”
export DOCKER_CERT_PATH=“/Users/shaswati/.docker/machine/machines/dtechinspiration”
export DOCKER_MACHINE_NAME=“dtechinspiration”
# Run this command to configure your shell:
# eval $(docker-machine env dtechinspiration)

6. In the above command it will give you hint what next and which command you have to run.

=========================================================
Run docker vm
=========================================================
bash-3.2$ eval “$(docker-machine env dtechinspiration)”
bash-3.2$ docker run hello-world

 

Access container ports

bash-3.2$ docker run -d -P –name web dtechinspiration

The -d flag keeps the container running in the background after the docker run command completes. The -P flag publishes exposed ports from the container to your local host; this lets you access them from your Mac.

Unable to find image ‘dtechinspiration:latest’ locally
Pulling repository docker.io/library/dtechinspiration
docker: Error: image library/dtechinspiration not found.
See ‘docker run –help’.
bash-3.2$ docker run -d -P –name web nginx
Unable to find image ‘nginx:latest’ locally
latest: Pulling from library/nginx
8b87079b7a06: Pull complete
a3ed95caeb02: Pull complete
31c7abf879e0: Pull complete
4ef177b369db: Pull complete
Digest: sha256:46a1b05e9ded54272e11b06e13727371a65e2ef8a87f9fb447c64e0607b90340
Status: Downloaded newer image for nginx:latest
72394dbe59ee00329a9144f44dbe5870a62f6d29746a004b00c697cd3ede1335

Display your running container with docker ps command

bash-3.2$ docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
72394dbe59ee nginx “nginx -g ‘daemon off” 12 minutes ago Up 2 minutes 0.0.0.0:32769->80/tcp, 0.0.0.0:32768->443/tcp web
bash-3.2$

This tells you that the web container’s port 80 is mapped to port 32769 on your Docker host.

Enter the http://localhost:32769 address (localhost is 0.0.0.0) in your browser:

 

Get the address of the default VM.

bash-3.2$ docker-machine ip dtechinspiration
192.168.99.101

Now Run the nginx in web browser.