Docker Environment Construction for ubuntu14+java8

  docker, java8

Install doc

apt-get install curl
curl -sSL https://get.docker.com/ | sh

Pull a mirror image of ubuntu

sudo docker pull ubuntu:14.04

Start and run the mirror

sudo docker run -it --name usshd ubuntu:14.04 /bin/bash

Install sshd

sudo apt-get update && apt-get install -y openssh-server
sudo mkdir -p /var/run/sshd
sudo echo 'root:root' | chpasswd#修改root登录密码
sudo sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
sudo sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
sudo echo "export VISIBLE=now" >> /etc/profile

vim

sudo apt-get install vim

telnet client

sudo apt-get install telnet

java8

sudo apt-get install software-properties-common 
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install -y oracle-java8-installer oracle-java8-set-default

Environment variable configuration

vim ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
source ~/.bashrc
echo $JAVA_HOME

Create mirror

sudo docker commit usshd ubuntu/java8

Usshd here was previously specified when docker run/create –name

sudo docker images