Mirroring is often very large in Linux, but using Docker images is an exception. With images made with Linux Docker, the small may be only a few M. This article will introduce how to make Docker images smaller in Linux systems.
conventional image writing:
FROM ubuntu: 12.04
RUN apt-get update
RUN apt-get install -y nginx zip Curl
RUN echo “daemon off;” 》 /etc/nginx/nginx.conf
RUN curl -o /usr/share/nginx/www/master.zip -L Https://codeload.github.com/gabrielecirulli/2048/zip/master
RUN cd /usr/share/nginx/www/&& unzip master.zip && mv 2048-master /*. && rm -rf 2048-master master.zip
EXPOSE 80
CMD [“/usr/sbin/nginx”, “-c”, “/etc/Nginx/nginx.conf”]
Linux makes Docker images smaller
Based on ubuntu12.04, first update, then install nginx, zip, curl, configure nginx, download 2048 Code, decompress and put it in the specified location, delete the original file, throw port 80, and finally execute the command.
Such a dockerfile is no longer familiar, just like the docker hub or other teaching documentation. Next, let's talk about the middle of the problem.
1. How long does it take to pull a ubuntu, and how much space does it take? (Beginners have a lot of headaches at this step.) 2. What is the pain of updating Ubuntu without adding a Chinese image source? 3, configuration 4, the entire generated mirror is huge, playing a 2048 does not need to be so complicated.
Ask questions, don't give a solution to be a rogue, or look at the dockerfile:
FROM alpine:latest
MAINTAINER alex [email protected]
RUN apk --update add nginx
COPY . /usr/share/nginx/html
EXPOSE 80
CMD [“nginx”, “-g”, “daemon off;”]
Simplified use of dockerfile and base mirror and github features, can be less than one less sentence, move hands, so build, the entire image is no more than 10M, look back at the previous image, how much a ubuntu, ah, It is really necessary for home.
The above is how to make the Docker image smaller in the Linux system. The smaller the Linux image, the less space it takes, and the installation is faster.
The operation of the log under the Linux system mainly includes dumping, mailing, a
Different systems set the time method differently, and can set the system time in different ways. Fo
Ubuntu installed graphics driver is sometimes not so smooth, will prompt an error and cause Nvidia d
We often need to upload or download files in our daily work, and Linux users are no exception. So in
Linux installation VMware Tools virtual machine graphic tutorial
Ubuntu configuration steps using OpenDNS
How to install and configure Git in Ubuntu system
How to mount an external device in a Linux system
Linux ifconfig command usage summary
Notes on operating online replacement files on Linux systems
Linux removes the physical volume of PV in LVM
Ubuntu 14.04 method for loading shutdown/restart options in Dash
Solution for adb connection failure under Mac or Linux
Linux upgrade Mysql error conflict with file how to do?
Linux cancels the SSH login password
How to deal with the disappearance of ibus input method icon after upgrading Ubuntu 12.04?
Win8 wireless network limited or no connection solution
Fix the problem that Windows 7 Favorites can't be expanded
WinXP system collection function magical
How to solve the problem that the Win7 system 360 browser can't open the webpage
Install win7 boot check media prompt how to do
How to open Ethernet in win8 system? Win8 system to open Ethernet method
Safety first Windows 7 five things should know about
Modifying the Registry to Improve Win8/RT Touch Response
Excel Tutorial: How to convert incoming data to a computable computing format