0% found this document useful (0 votes)
128 views5 pages

Docker Was

The document shows the steps to install and configure Docker on an EC2 Linux server. It demonstrates pulling the Centos image, running containers, and inspecting images and containers. Commands used include docker pull, docker run, docker ps, docker inspect, and docker history to interact with and view information about Docker images and containers.

Uploaded by

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

Docker Was

The document shows the steps to install and configure Docker on an EC2 Linux server. It demonstrates pulling the Centos image, running containers, and inspecting images and containers. Commands used include docker pull, docker run, docker ps, docker inspect, and docker history to interact with and view information about Docker images and containers.

Uploaded by

redankaiahu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

login as: ec2-user

[ec2-user@ip-172-31-5-217 ~]$ sudo su


[root@ip-172-31-5-217 ec2-user]#

[root@ip-172-31-5-217 ec2-user]# yum -y update

[root@ip-172-31-5-217 ec2-user]# yum -y install docker


[root@ip-172-31-5-217 ec2-user]# docker -v
Docker version 18.03.1-ce, build 3dfb8343b139d6342acfd9975d7f1068b5b1c3d3

[root@ip-172-31-5-217 ec2-user]# service docker start


Starting cgconfig service: [ OK ]
Starting docker: . [ OK ]
[root@ip-172-31-5-217 ec2-user]#

[root@ip-172-31-5-217 ec2-user]# docker version


Client:
Version: 18.03.1-ce
API version: 1.37
Go version: go1.9.4
Git commit: 3dfb8343b139d6342acfd9975d7f1068b5b1c3d3
Built: Thu May 24 22:21:27 2018
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm

Server:
Engine:
Version: 18.03.1-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.4
Git commit: 7390fc6/18.03.1-ce
Built: Thu May 24 22:22:43 2018
OS/Arch: linux/amd64
Experimental: false
[root@ip-172-31-5-217 ec2-user]#

[root@ip-172-31-5-217 ec2-user]# docker search hello-world

[root@ip-172-31-5-217 ec2-user]# pwd


/home/ec2-user
[root@ip-172-31-5-217 ec2-user]# docker pull docker.io/centos
Using default tag: latest
latest: Pulling from library/centos
7dc0dca2b151: Pull complete
Digest: sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa5322
Status: Downloaded newer image for centos:latest
[root@ip-172-31-5-217 ec2-user]#

[root@ip-172-31-5-217 ec2-user]# docker images


REPOSITORY TAG IMAGE ID CREATED
SIZE
centos latest 49f7960eb7e4 3 weeks ago
200MB
[root@ip-172-31-5-217 ec2-user]#

[root@ip-172-31-5-217 ec2-user]# docker image ls


REPOSITORY TAG IMAGE ID CREATED
SIZE
centos latest 49f7960eb7e4 3 weeks ago
200MB

TO KNOW DETAILED INFORMATION ABOUT DOCKER IMAGE


[root@ip-172-31-5-217 ec2-user]# docker inspect 49f7960eb7e4

[root@ip-172-31-5-217 ec2-user]# docker history 49f7960eb7e4


IMAGE CREATED CREATED BY
SIZE COMMENT
49f7960eb7e4 3 weeks ago /bin/sh -c #(nop) CMD ["/bin/bash"]
0B
<missing> 3 weeks ago /bin/sh -c #(nop) LABEL org.label-
schema.sc? 0B
<missing> 3 weeks ago /bin/sh -c #(nop) ADD
file:8f4b3be0c1427b158? 200MB

[root@ip-172-31-5-217 ec2-user]# docker ps


CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES

docker ps -a
docker ps -a -q
docker ps -q

docker stop cID


docker kill CID

docker run -d ubuntu

[root@ip-172-31-5-217 ec2-user]# docker run -d ubuntu


86b4fbf83e0ee597f6fafe4cc49dffed2466c06d0fae4a2faffbc1e18a07bf4c

docker images -q ( -q shows only image id or container id )

#docker run -itd -p 80:80 tutum/hello-world


# docker run -it centos

jul 18

root@ubuntu:/home/theuppala# sudo docker run -it --entrypoint /bin/bash


crorvick/redhat

jul19

amanly/websphere_8_5_5
*************************
docker run -i -t -p 28000:28000 -p 28001:28001 -v /tmp/websphere:/tmpfromhost
amanly/websphere_8_5_5 bash
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin
http://172.17.0.2:28000/ibm/console (working in ubuntu it self )

username: wasadmin
password: wasadmin

jul 21
******
to give name to the image
#docker run -it --name devops-1 Centos
change exisiting container name
#docker rename quirky_beaver devops-2

upto 100 star ratings (above)


#docker search -s 100 jenkins

#docker run -it centos -- by deafult host name will get container id

while running it self have to provide hostname

#docker run -it -h batch24 centos

#docker attach container id ( will switch to root dirctly)

To enter a running container


#docker attach e56783uyyy

to enter a specific user to a container


#docker exec -it -u theuppala 3343436633 /bin/bash

to share files from host to container

#docker run -it --name server1 -v /opt/mvn:/opt centos

here /opt/mvn - host folder


and /opt container folder
-v refereed as Volume

share container to another container

#docker run -it --volumes-from cid centos


cid - container id (first container)
cenntos - another container

#docker start cid


displays cpu,mem usage,limit of container

To set memory utillization to a container


#docker run -itd -m 300M Centos

To see recent ran commands


#docker logs cid

#docker attach cid

hostname ,uname -a
To create a docker file - for creating images
#vi dockerfile
-->in vi file

FROM ubuntu:latest (latest - will take latest version or we can provide


version num)
MAINTAINER theuppala <[email protected]>
RUN apt-get update -y

---> save the file

#docker images
#docker build -t "ubuntu_uppala" .
#docker images
#docker run -it ubuntu_uppala

for centos
------------
FROM centos:latest
RUN yum update -y
RUN yum install httpd -y

Docker Weblogic

How To Use:
docker pull ismaleiva90/weblogic12
To start the docker machine with 7001, 7002 and 5556 ports opened:
docker run -d -p 49163:7001 -p 49164:7002 -p 49165:5556
ismaleiva90/weblogic12:latest
Web Console
http://localhost:49163/console
User: weblogic
Pass: welcome1

Use the command docker exec -it <container name> /bin/bash to get a bash shell in
the container.

You might also like