Docker - 059
备注
created by || rick
⏲️ Release Date // 2024-01-07
💀 Solvers // 7
🧩 Type // docker
flag
HMV{h1kinG_1s_s0_fUn}
运行 docker
建议对 Dockerfile 做一定修改,便于加快镜像的编译
FROM php:7.3-apache
# apt 更换镜像源,并更新软件包列表信息
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list &&
sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
RUN apt-get update
RUN apt update && apt install -y mariadb-server mariadb-client && apt install -y supervisor
RUN docker-php-ext-install mysqli
COPY . /var/www/html
RUN chmod -R 0755 /var/www/html
COPY config/supervisord.conf /etc/supervisord.conf
EXPOSE 80
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
编译镜像
randark@developer:~/code/h1ker-main$ docker build -t h1ker .
[+] Building 28.0s (13/13) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 597B 0.0s
=> [internal] load metadata for docker.io/library/php:7.3-apache 3.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> CACHED [1/8] FROM docker.io/library/php:7.3-apache@sha256:b9872cd287ef72bc17d45d713aa2742f3d3bcf2503fea2506fd93aa94995219f 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 7.15kB 0.0s
=> [2/8] RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list 0.2s
=> [3/8] RUN apt-get update 2.1s
=> [4/8] RUN apt update && apt install -y mariadb-server mariadb-client && apt install -y supervisor 12.7s
=> [5/8] RUN docker-php-ext-install mysqli 8.8s
=> [6/8] COPY . /var/www/html 0.0s
=> [7/8] RUN chmod -R 0755 /var/www/html 0.4s
=> [8/8] COPY config/supervisord.conf /etc/supervisord.conf 0.0s
=> exporting to image 0.6s
=> => exporting layers 0.6s
=> => writing image sha256:e7fc722a0803cff8b9db894d303f5cd07788e9f1de229c18d4cb31ec0b28d3c0 0.0s
=> => naming to docker.io/library/h1ker
然后基于镜像启动一个容器
randark@developer:~/code/h1ker-main$ docker run --name=h1ker -d -p 1337:80 h1ker
1ffb5859282779260f56679b425fd0db47ce2d12cfc96cc5190fa4e0f6400960
randark@developer:~/code/h1ker-main$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1ffb58592827 h1ker "docker-php-entrypoi…" 10 seconds ago Up 10 seconds 0.0.0.0:1337->80/tcp, :::1337->80/tcp h1ker
测试服务