0% found this document useful (0 votes)
4 views7 pages

Dev Ops 4

The document provides an overview of Docker, explaining its functionality as a containerization tool that allows applications to run consistently across different Linux environments. It includes installation instructions for Java and Docker on Ubuntu, along with commands for managing Docker containers and images. Additionally, it outlines configurations for Gitbucket and Jenkins on Docker, as well as steps for installing and configuring Apache Tomcat.

Uploaded by

Vo Tinh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views7 pages

Dev Ops 4

The document provides an overview of Docker, explaining its functionality as a containerization tool that allows applications to run consistently across different Linux environments. It includes installation instructions for Java and Docker on Ubuntu, along with commands for managing Docker containers and images. Additionally, it outlines configurations for Gitbucket and Jenkins on Docker, as well as steps for installing and configuring Apache Tomcat.

Uploaded by

Vo Tinh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

application with all of the parts it needs, such as libraries and other

dependencies, and ship it all out as one package. By doing so, thanks to the
container, the developer can rest assured that the application will run on any
other Linux machine regardless of any customized settings that machine might
have that could differ from the machine used for writing and testing the code.
In a way, Docker is a bit like a virtual machine. But unlike a virtual machine,
rather than creating a whole virtual operating system, Docker allows
applications to use the same Linux kernel as the system that they're running on
and only requires applications be shipped with things not already running on
the host computer. This gives a significant performance boost and reduces the
size of the application.
And importantly, Docker is open source. This means that anyone can contribute
to Docker and extend it to meet their own needs if they need additional
features that aren't available out of the box.

>> Install Java on


ubuntu Server
>> sudo apt-get update -y
>> sudo apt-get upgrade -y
>> add-apt-repository ppa:webupd8team/java
>> apt-get update -y
>> apt-get install oracle-java8-installer
>> java -version
>> sudo apt update
>> sudo apt-key adv --keyserver hkp://[Link].
net:80 --recv-keys
58118E89F3A912897C070ADBF76221572C52609D
>> sudo apt-add-repository "deb
[Link] ubuntu-xenial main"
>> sudo apt update
>> sudo apt install docker-engine
>> sudo systemctl start docker
>> docker images
>> docker pull ubuntu
>> root@ubuntu:/home/student# docker --help
Options:
--config string Location of client config files (default
"/root/.docker")
-D, --debug Enable debug mode
--help Print usage
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level
("debug"|"info"|"warn"|"error"|"fatal")
(default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default
"/root/.docker/[Link]")
--tlscert string Path to TLS certificate file (default
"/root/.docker/[Link]")
--tlskey string Path to TLS key file (default
"/root/.docker/[Link]")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit
Management Commands:
container Manage containers
image Manage images
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
secret Manage Docker secrets
service Manage services
stack Manage Docker stacks
swarm Manage Swarm
system Manage Docker
volume Manage volumes

Commands:
attach Attach local standard input, output, and error streams 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 to files or directories 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 Docker objects
kill Kill one or more running containers
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
pause Pause all processes within one or more containers
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 one or more containers
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 (streamed to STDOUT by
default)
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 one or more running containers
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
version Show the Docker version information
wait Block until one or more containers stop, then print their exit codes
To run Images:-
>> docker images
>> docker run -ti --rm ubuntu /bin/bash\
>> docker ps
>> docker ps –a
>> docker run -ti ubuntu /bin/bash
>> docker ps
>> docker ps –a
>> docker exec -ti <container id> /bin/bash
>> docker run -ti --name “ubuntu18” --hostname ”pivotal”
ubuntu /bin/bash
>> docker start <container id>
>> docker stop <container id>
>> docker rm <container id>
>> docker image rm <image id)
Gitbucket Configuration on Docker:-
Need to maintain [Link] file and Dockerfile in /root
Dir.
>> vi Dockerfile
From java:latest
MAITAINER student@[Link]
LABEL evn=production
ENV apparea /data/app
Run mkdir -p $apparea
ADD ./[Link] $apparea
WORKDIR $apparea
CMD ["java","-jar","[Link]"]
:wq!
>> docker build –t pivotal/git . (to build Dockerfile)
>> docker images
>> docker run -d -p 80:8080 pivotal/git (to port forwarding)
>> ifconfig
Open Firefox and give [Link]:80 to launch gitbucket
server

Jenkins Configuration on Docker:-


Need to maintain [Link] file and Dockerfile in /root
Dir.
>> vi Dockerfile
From java:latest
MAITAINER student@[Link]
LABEL evn=production
ENV apparea /data/app
Run mkdir -p $apparea
ADD ./[Link] $apparea
WORKDIR $apparea
CMD ["java","-jar","[Link]"]
:wq!
>> docker build –t pivotal/git . (to build Dockerfile)
>> docker images
>> docker run -d -p 80:8080 pivotal/jenkins (to port forwarding)
>> ifconfig
Open Firefox and give [Link]:80 to launch gitbucket
server
Apache tomcat server:-
Download apache-tomcat app from internet
#tar -xvf apache-tomcat -C /opt/
#cd /opt/apache-tomcat/bin
#./[Link]
#firefox &
[Link]
set user Path--------------
#vi /opt/apache-tomcat/conf/[Link]
<role rolename="manager-gui"/>
<user username="student" password="redhat" roles="manager-gui"/>
</tomcat-users>
:wq!
[Link]
open manager app and deploy .war files
ex: [Link]

Install Apache Tomcat 8:-


>> apt-get update
>> apt-get install default-jdk
>> groupadd tomcat
>> useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
>> cd /tmp
>> curl -O [Link]
8/v8.5.5/bin/[Link]
>> mkdir /opt/tomcat
>> tar xzvf apache-tomcat-8*[Link] -C /opt/tomcat --strip-components=1
>> /opt/tomcat
>> chgrp -R tomcat /opt/tomcat
>> chmod -R g+r conf
>> chmod g+x conf

You might also like