Simple Docker workflow – Quick start | Docker Tutorial

docker-workflow
Simple Docker workflow – Quick start
In this tutorials, I am trying to cover the simple quickstart Docker workflow and for the example, I am creating Ubantu containee and using it to showcase this tutorial.
Step 1 – Download the Ubantu image container from the Docker Hub
# docker pull -a ubuntu
Step 2 – Run the ubuntu container and access to ther /bin/bash commands prompt
# docker run -it ubuntu /bin/bash
Step 3 – Stop the container 
# docker stop container_id
How to get the container id?
# docker ps -a
Step 4: Start the container again?
# docker start container_id
Step 5: Exit the running container without stopping the container
# exit
Step 6: Login the running container for bash prompt
# sudo docker exec -i -t 2e56ad1705b1 /bin/bas
For more – Refer 
Tagged : / / / / / / / / /

How to Install Docker in Linux?

install-docker-in-linux
How to Install Docker in Linux?
Note – You should install Docker using root or with sudo access.
Install Docker on Ubantu 
# apt-get update
# apt-get install -y docker.io
# service docker.io start
Install Docker on Redhar / Centos
# yum update
# yum install -y docker.io
# systemctl start docker.service
How to verify the version of docker?
# docker -v
# docker version
How to know docker running?
# service docker.io status (Ubantu)
# systemctl status docker.service (Redhat)
How to check details of Docker clients, deamon, containers, images, drivers, etc
# docker info
How to update Docker version?
==============================================
# wget -q0- https://get.docker.com/gpg | apt-key add –
# echo deb http://get.docker.com/ubantu docker main > /etc/apt/sources.list.d/docker.list
# apt-get update
# apt-get install lxc-docker
# docker version
Configuration post docker installation:
Adding Users to the Docker Group for non-root user
==============================================
# docker run -it ubuntu /bin/bash (as a non-root)
[ permission denied]
# cat /etc/group
# sudo gpasswd -a username docker
# cat /etc/group
# docker run -it ubuntu /bin/bash (as a non-root)
# logout
# login username
Tagged : / / / / / / / / / /

How to get bash or ssh into a running container in background mode?

bash-or-ssh-into-a-running-container
How to get bash or ssh into a running container in background mode?
Step 1: First of all, try to find your active container by running
# docker ps
or
# docker ps -a
Step 2: If the container is not running,
# docker start your_id
Step 3: If we use attach we can use only one instance of shell.
# sudo docker attach 665b4a1e17b6 #by ID
or
# sudo docker attach loving_heisenberg #by Name
If we want open new terminal with new instance of container’s shell, we just need run the following:
# sudo docker exec -i -t 2e56ad1705b1 /bin/bash #by ID
or
# sudo docker exec -i -t loving_heisenberg /bin/bash #by Name
# root@665b4a1e17b6:/#
Step 4: To exit bash without leaving bash running in a rogue process
# exit
Notes:
A reminder for boot2docker users: remove sudo
If you are using docker in Linux, you will have to use sudo along with docker commands.
You should try not to run commands as sudo, rather add your user to the docker group and just run normally.
Tagged : / / / / / / / /

How to install Atlassian Jira using Docker?

install-atlassian-jira-using-docker
Install Atlassian Jira using Docker
Download and Run the jira latest:
docker run –detach –publish 8080:8080 cptactionhank/atlassian-jira:latest
Then simply navigate your preferred browser to http://[dockerhost]:8080 and finish the configuration.
Notes:
JIRA Home location: /var/atlassian/jira
JIRA Installation location: /opt/atlassian/jira
Reference:
Tagged : / / / / / / / / / /

Location of Docker images in all Operating Systems (Linux, Windows, Redhat, Mac OS X)

location-of-dockers-images
Location of Dockers images in all Operating Systems
The location of the images vary depending on the driver Docker is using for storage. Actually, Docker images are stored in two files as shown by following command.
# docker info
aufs – Most linux version
/var/lib/docker/aufs/diff/<id> has the file contents of the images.
/var/lib/docker/repositories-aufs is a JSON file containing local image information. This can be viewed with the command docker images.
btrfs
TBD
devicemapper (Redhat)
/var/lib/docker/devicemapper/devicemapper/data – stores the images
/var/lib/docker/devicemapper/devicemapper/metadata – the metadata
vfs
TBD
Mac OS X
~/VirtualBox VMs/boot2docker-vm
Mac OS X using boot2docker 
/Users/rajesh.kumar/.docker/machine/machines/default
File Name – disk.vmdk
Windows:
%USERPROFILE%/VirtualBox VMs/boot2docker-vm
You can manually set the storage driver with the -s or –storage-driver= option to the Docker daemon.
/var/lib/docker/{driver-name} will contain the driver specific storage for contents of the images.
/var/lib/docker/graph/<id> now only contains metadata about the image, in the json and layersize files.
Reference
Tagged : / / / / / / / / / / / / / / / / / / / /

Sonatype Nexus installation using Docker

sonatype-nexus-installation-using-docker

Sonatype Nexus Repository Manager 2

Install a Docker Engine
Installation Instructions can be found here – http://www.devopsschool.com/tutorial/docker/docker-install-and-configuration.html

Download a Sonatype Nexus Image
> docker pull sonatype/nexus

For Sonatype Nexus Repository Manager 2 OSS, To run (if port 8081 is open on your host):
> docker run -d -p 8081:8081 –name nexus sonatype/nexus:oss

For Sonatype Nexus Repository Manager 2 PRO, To run (if port 8081 is open on your host):
> docker run -d -p 8081:8081 –name nexus sonatype/nexus:pro

To determine the port that the container is listening on:
> docker ps -l

To Test
> curl http://localhost:8081/nexus/service/local/status

Browse Following URL
http://localhost:8081/nexus/

It can take some time (2-3 minutes) for the service to launch in a new container. You can tail the log to determine once Nexus is ready:
> docker logs -f nexus

Note
Default credentials are: admin / admin123
Installation of Nexus is to /opt/sonatype/nexus
Notably: /opt/sonatype/nexus/conf/nexus.properties is the properties file.
Parameters (nexus-work and nexus-webapp-context-path) defined
here are overridden in the JVM invocation.

Sonatype Nexus Repository Manager 3

Install a Docker Engine
Installation Instructions can be found here – http://www.devopsschool.com/tutorial/docker/docker-install-and-configuration.html

Clone the Repostory from Gihub
> git clone https://github.com/sonatype/docker-nexus3
> cd docker-nexus3

Build a Image for Sonatype Nexus Repository Manager 3 OSS
> docker build –rm –tag sonatype/nexus oss/

Build a Image for Sonatype Nexus Repository Manager 3 PRO
> docker build –rm –tag sonatype/nexus:pro pro/

For Sonatype Nexus Repository Manager 2 OSS, To run (if port 8081 is open on your host):
> docker run -d -p 8081:8081 –name nexus sonatype/nexus:oss

For Sonatype Nexus Repository Manager 2 PRO, To run (if port 8081 is open on your host):
> docker run -d -p 8081:8081 –name nexus sonatype/nexus:pro

To determine the port that the container is listening on:
> docker ps -l

To Test
> curl http://localhost:8081/nexus/service/local/status

Browse Following URL
http://localhost:8081/nexus/

It can take some time (2-3 minutes) for the service to launch in a new container. You can tail the log to determine once Nexus is ready:
> docker logs -f nexus

Note
Default credentials are: admin / admin123
Installation of Nexus is to /opt/sonatype/nexus
Notably: /opt/sonatype/nexus/conf/nexus.properties is the properties file.
Parameters (nexus-work and nexus-webapp-context-path) defined
here are overridden in the JVM invocation.

Reference
https://hub.docker.com/r/sonatype/nexus/

Tagged : / / / / / / / / / / / /