Skip to content

Instantly share code, notes, and snippets.

@ygmpkk
Created February 23, 2015 09:55
Show Gist options
  • Save ygmpkk/4088b9648efbcc584e5a to your computer and use it in GitHub Desktop.
Save ygmpkk/4088b9648efbcc584e5a to your computer and use it in GitHub Desktop.
dockerfile source list
FROM ubuntu:14.04
ENV DEBIAN_FRONTEND noninteractive
##///*******************************************************/
##//------------------------
## append apt mirror for ubuntu, update & install
##//------------------------
## RUN sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse" > /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list
## do update, upgrade (which may not be needed) & install:
RUN apt-get update -y && apt-get -y upgrade
RUN apt-get install -y debconf build-essential \
software-properties-common python-software-properties \
nano vim git htop wget curl nload unzip
RUN rm -rf /var/lib/apt/lists/*
##//------------------------
## add repo for latest redis & install
##//------------------------
RUN add-apt-repository ppa:chris-lea/redis-server && apt-get update
RUN apt-get install redis-server -y
## set redis default to bind to all nic's.
RUN sed -i 's/^\(bind .*\)$/# \1/' /etc/redis/redis.conf
#change ports as needed from 6379 to ...
#RUN sed -i "s/port 6379/port 6380/" /etc/redis/redis.conf
##///*******************************************************/
##//////////////////////////////////////////////////////////////////
# build: docker build -t vigour/redis-base .
# run: docker run -it --detach --name=redis-base vigour/redis-base
# cli: docker run -it --rm --name=redis-base vigour/redis-base
##// ATTACH to running master / slave instaces
# cli: docker run -it --rm --link=redis0:redis --name=redis-base vigour/redis-base
@mashirozx
Copy link

秒懂哈哈哈

@mashirozx
Copy link

18.04 LTS:

RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse" > /etc/apt/sources.list
RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse" >> /etc/apt/sources.list

@ygmpkk
Copy link
Author

ygmpkk commented May 14, 2020

理解能力很不错

@changsijay
Copy link

每個 RUN 都多一層 overlay 怎不寫成一行?

@mashirozx
Copy link

说的没错😂

@luochen1990
Copy link

应该可以一行 sed 搞定, 主要得测试下, , 我再找找有没有人搞好了..

@phantomgz
Copy link

@luochen1990

sed -i 's/archive.ubuntu.com/mirrors.cloud.tencent.com/g' /etc/apt/sources.list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment