Search This Blog

Tuesday, May 16, 2017

Docker - Setup with Two Tomcat with Nginx / SFTP

imp commands
find / -name tomcat8

Oracle jdk 1.8
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

#this will give all ip and other details
docker inspect

imp commands
docker run -it ubuntu
apt-get update
apt-get install vim
apt-get install net-tools
apt-get install python-software-properties
apt-get install software-properties-common
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java8-installer
apt-get install -y net-tools
apt-get update
apt-get install tomcat7 vim
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
vim /etc/default/tomcat7
# now ensure in tomcat7 file
# remove the comment
service tomcat7 start

wget localhost:8080

docker commit/push/pull
docker ps -a
docker commit
docker push drvijayy2k2/ubuntutomcat1
docker pull drvijayy2k2/ubuntutomcat1

to show all process - ps aux

Now instead of exiting the container, detach from it back to your terminal by typing:
ctrl-p then ctrl-q
(If you’re using gnu screen, remember it’s ctrl-a a ctrl-p, then ctrl-q)

sudo apt-get purge docker-engine
sudo apt-get autoremove --purge docker-engine

umount /var/lib/docker/overlay #check and remvoe all the containers
umount /var/lib/docker/overlay2

rm -rf /var/lib/docker # This deletes all images, containers, and volumes

ctrl + a + p + q

80, 8080,8081,8082, 8888 - opened for outside

docker run --name tomcat1 -p 8080:8080 -it drvijayy2k2/tomcat8
service tomcat8 start
wget localhost:8080
ctrl + a + p + q
browser - http://ip-1:8080/

you can change the root file
apt-get install vim
find / -name tomcat8
vi /var/lib/tomcat8/webapps/ROOT/index.html
vi /usr/share/tomcat8/

docker run --name tomcat2 -p 8081:8080 -it drvijayy2k2/tomcat8
service tomcat8 start
wget localhost:8080
backgroun [ -d is not working] - ctrl + a + p + q
browser - http://ip-2:8081/

#sudo docker run --name docker-nginx -p 80:80 -d -v ~/docker-nginx/tml:/usr/share/nginx/html nginx

docker run --name ubuntu-nginx -it -p 80:80 drvijayy2k2/nginx
vi /etc/nginx/conf.d/default.conf
service nginx start
ctrl + a + p + q
browser http://ip-3
docker attach

#add host entry c:\windows\system32\drivers\etc\hosts
open browser
#stop the tomcat to see or refersh, it will do the roundrobin by default

SFTP - ip-4
docker run -it -p 8081:22 drvijayy2k2/sftp
service vsftpd start
service ssh start
ctrl + a p q

open winscp
type ur public ip ip-4
port 8081
user john
pwd test123

copy some files to www folder

Hit Counter

View My Stats