Linux——docker启用配置:dockerfile——ubuntu

dockerfile

# base image
FROM ubuntu:latest

LABEL maintainer="Pan"
# WORKDIR /app

EXPOSE 3000
EXPOSE 35729

COPY sources.list /etc/apt
RUN apt-get update 
# && apt-get install -y locales 
# && apt-get install debconf 
# && echo "Asia/Shanghai" > /etc/timezone 
# && dpkg-reconfigure -f noninteractive tzdata  
# && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 
# && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen 
# && echo 'LANG="en_US.UTF-8"'>/etc/default/locale 
# && dpkg-reconfigure --frontend=noninteractive locales 
# && update-locale LANG=en_US.UTF-8 
&& apt-get install -y man 
&& apt-get install manpages 
&& apt-get install manpages-dev 
&& apt-get install manpages-posix 
&& apt-get install manpages-posix-dev

RUN apt-get install -y vim 
&& apt-get install -y procinfo 
&& apt-get install -y searchandrescue 
&& apt-get install -y sysstat 
&& apt-get install net-tools 
&& apt-get install -y iputils-ping

RUN apt-get install -y bind9-utils 
&& apt-get install -y dnsutils 
&& apt-get install -y sysstat

RUN apt-get install -y gcc 
&& apt-get install -y automake  
&& apt-get install -y autoconf  
&& apt-get install -y libtool  
&& apt-get install -y make 
&& apt-get install -y make-doc

RUN  apt-get install -y apt-utils 
&& apt-get install -y pstack 
&& apt-get install -y strace 
&& apt-get update 
# && apt-get install fuser
# && apt-get install -y gdb

RUN apt-get install lsof 
&& apt-get install htop 
&& apt-get install -y wget

# CMD ["/bin"]
# CMD ["/bin", "/run.sh","start"]

  

  

run.sh

#!/usr/bin/env bash
set -eo pipefail

pm2 start npm -- start
if [ -t 0 ]; then
  #tty model
  echo "using TTY model"
else 
  /usr/bin/tail -f /dev/null
fi

  

.dockerignore

#ignore 

  

 docker启动命令

PS D:*****> docker build -t ubuntu_self_practice:v1.1 .
……
Removing intermediate container 872c0672056e
 ---> d9ae6d71651f
Successfully built d9ae6d71651f
Successfully tagged ubuntu_self_practice:v1.1
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.


PS D:*****> docker run -ti  d9ae6d71651f
root@e343c6d1b469:/#  

 

参考 

https://github.com/dockerfile/ubuntu/blob/master/Dockerfile

https://github.com/dockerfile/ubuntu-desktop

原文地址:https://www.cnblogs.com/panpanwelcome/p/12720303.html