标签:style blog http color io os 使用 java ar
运行一个ubuntu容器
docker run -i -t ubuntu /bin/bash
备份apt源
cp /etc/apt/sources.list /etc/apt/sources.list.bak
修改apt源
vi /etc/apt/sources.list
替换所有源为sohu源
deb http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse
或网易源
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
修改保存后退出运行的容器
exit
查看最后一个运行的容器
docker ps -l
提交本次修改的镜像为 ubuntu/sohu
docker commit 698 ubuntu/sohu
使用修改后源的镜像做Dockerfile
# VERSION 0.0.1 FROM ubuntu/sohu MAINTAINER myemail "myemail@gmail.com" RUN apt-get update RUN apt-get install -y openssh-server RUN mkdir -p /var/run/sshd RUN echo "root:123456" | chpasswd RUN apt-get install python-software-properties RUN add-apt-repository ppa:webupd8team/java RUN apt-get update RUN apt-get install -y vim wget curl oracle-java7-installer tomcat7 RUN update-alternatives --display java RUN echo "JAVA_HOME=/usr/lib/jvm/java-7-oracle">> /etc/environment RUN echo "JAVA_HOME=/usr/lib/jvm/java-7-oracle">> /etc/default/tomcat7 EXPOSE 22 EXPOSE 8080 ENTRYPOINT service tomcat7 start && /usr/sbin/sshd -D
需要注意:
启动新建的容器
docker run -d -p 22 -p 8080:8080 saint/tomcat7
http://www.blogjava.net/yongboy/archive/2013/12/16/407643.html
Dockerfile 命令解释
http://blog.tankywoo.com/docker/2014/05/08/docker-2-dockerfile.html
查找apt软件
apt-cache search tomcat
标签:style blog http color io os 使用 java ar
原文地址:http://www.cnblogs.com/saintaxl/p/3987432.html