Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------------- Docker file -----------------------------------------------------------
- [ec2-user@ip-172-31-44-129 alpine]$ cat Dockerfile
- FROM httpd:alpine
- ENV HOME_DIR /usr/local/apache2/
- ENV USER chris
- WORKDIR $HOME_DIR
- RUN adduser -h $HOME_DIR -s /bin/sh -u 1005 -D chris
- COPY ./public_html htdocs/
- RUN mkdir .ssh/
- COPY ./chrisops.pub .ssh/authorized_keys
- RUN apk update && apk add supervisor openssh --no-cache
- RUN ssh-keygen -A
- RUN mv /usr/sbin/sshd /usr/bin/sshd
- RUN cp /etc/ssh/ssh_host* .
- RUN sed -i 's+#HostKey /etc/ssh/+HostKey /usr/local/apache2/+g' /etc/ssh/sshd_config
- RUN chown -R $USER. $HOME_DIR
- COPY ./supervisor.conf .
- EXPOSE 22 80
- USER $USER
- ENTRYPOINT ["/usr/bin/supervisord"]
- CMD ["-c","supervisor.conf"]
- ------------------------------------------------------ Supervidor.conf ----------------------------------------------------
- [ec2-user@ip-172-31-44-129 alpine]$ cat supervisor.conf
- [supervisord]
- nodaemon=true
- [program:sshd]
- command=/usr/bin/sshd -D
- [program:httpd]
- command=httpd-foreground
- ------------------------------------------------- Docker image ------------------------------------------------
- [ec2-user@ip-172-31-44-129 alpine]$ docker image build -t chrishttpd:1 .
- Sending build context to Docker daemon 2.371MB
- Step 1/19 : FROM httpd:alpine
- [ec2-user@ip-172-31-44-129 alpine]$ docker container run --name c1 -d -p 80:80 chrishttpd:1
- 1f8227969220d7cb901009a20b74e5803e67766010f996f7294df0ae94007281
- [ec2-user@ip-172-31-44-129 alpine]$ docker network inspect bridge
- "Containers": {
- "1f8227969220d7cb901009a20b74e5803e67766010f996f7294df0ae94007281": {
- "Name": "c1",
- "EndpointID": "d0e803ef994a25dbaa5240052952bfd919bd409ce86dace21da38f8c2f94ba7c",
- "MacAddress": "02:42:ac:11:00:02",
- "IPv4Address": "172.17.0.2/16",
- "IPv6Address": ""
- }
- },
- ------------------------------------------Output --------------------------------------------
- [ec2-user@ip-172-31-44-129 alpine]$ ssh -i chrisops [email protected]
- The authenticity of host '172.17.0.2 (172.17.0.2)' can't be established.
- ED25519 key fingerprint is SHA256:pKzvGv4OlEQPVWPod+tJVIZorKzqmEfdtjP7Xwb/gzc.
- This key is not known by any other names
- Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
- Warning: Permanently added '172.17.0.2' (ED25519) to the list of known hosts.
- Welcome to Alpine!
- The Alpine Wiki contains a large amount of how-to guides and general
- information about administrating Alpine systems.
- See <https://wiki.alpinelinux.org/>.
- You can setup the system with the command: setup-alpine
- You may change this message by editing /etc/motd.
- 1f8227969220:/usr/local/apache2$
- 1f8227969220:/usr/local/apache2$
- ---------------------------------Every process running in chris user -----------------------------------
- 1f8227969220:/usr/local/apache2$ ps aux
- PID USER TIME COMMAND
- 1 chris 0:00 {supervisord} /usr/bin/python3 /usr/bin/supervisord -c supervisor.conf
- 7 chris 0:00 httpd -DFOREGROUND
- 8 chris 0:00 sshd: /usr/bin/sshd -D [listener] 0 of 10-100 startups
- 10 chris 0:00 httpd -DFOREGROUND
- 11 chris 0:00 httpd -DFOREGROUND
- 12 chris 0:00 httpd -DFOREGROUND
- 94 chris 0:00 sshd: chris [priv]
- 96 chris 0:00 sshd: chris@pts/0
- 97 chris 0:00 -sh
- 98 chris 0:00 ps aux
Advertisement
Add Comment
Please, Sign In to add comment