-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
FROM redis:2.8.13 | ||
|
||
# switch to root to build image | ||
# ================================================= | ||
USER root | ||
|
||
# prepare rootfs | ||
# ================================================= | ||
RUN mkdir /rootfs | ||
WORKDIR /rootfs | ||
RUN mkdir bin etc dev dev/pts lib usr proc sys tmp | ||
RUN mkdir -p usr/lib64 usr/bin usr/local/bin | ||
RUN touch etc/resolv.conf | ||
RUN cp /etc/nsswitch.conf etc/nsswitch.conf | ||
RUN echo root:x:0:0:root:/:/bin/sh > etc/passwd | ||
RUN echo root:x:0: > etc/group | ||
RUN ln -s lib lib64 | ||
RUN ln -s bin sbin | ||
|
||
# install busybox | ||
# ================================================= | ||
ADD https://busybox.net/downloads/binaries/1.21.1/busybox-x86_64 /sbin/busybox | ||
RUN chmod +x /sbin/busybox | ||
RUN cp /sbin/busybox bin | ||
RUN busybox --install -s bin | ||
|
||
# extract redis-server | ||
# ================================================= | ||
RUN cp /usr/local/bin/redis-server usr/bin/redis-server | ||
|
||
# extract redis-server's dependencies | ||
# ================================================= | ||
RUN bash -c "cp /lib/x86_64-linux-gnu/lib{m,dl,pthread,c}.so.* lib64" | ||
RUN cp /lib64/ld-linux-x86-64.so.2 lib64/ | ||
|
||
# build rootfs | ||
RUN tar cf /rootfs.tar . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
$docker run -d temp:latest | ||
$docker ps | ||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | ||
2779bca0c7e5 temp:latest "/entrypoint.sh demo" 2 seconds ago Up 1 seconds 6379/tcp stoic_galileo | ||
$docker cp 2779bca0c7e5:/rootfs.tar /tmp/ |