-
Notifications
You must be signed in to change notification settings - Fork 25
/
Dockerfile
35 lines (30 loc) · 1.24 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Sample container image with Ubuntu Focal + Systemd + Sshd + Docker.
#
# Usage:
#
# $ docker run --runtime=sysbox-runc -it --rm -P --name=syscont nestybox/ubuntu-focal-systemd-docker
#
# This will run systemd and prompt for a user login; the default
# user/password in this image is "admin/admin". Once you log in you
# can run Docker inside as usual. You can also ssh into the image:
#
# $ ssh admin@<host-ip> -p <host-port>
#
# where <host-port> is chosen by Docker and mapped into the system container's sshd port.
#
FROM ghcr.io/nestybox/ubuntu-focal-systemd:latest
# Install Docker
RUN apt-get update && apt-get install -y curl \
&& rm -rf /var/lib/apt/lists/* \
&& curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh \
# Add user "admin" to the Docker group
&& usermod -a -G docker admin
ADD https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker /etc/bash_completion.d/docker.sh
# Install Sshd
RUN apt-get update && apt-get install --no-install-recommends -y openssh-server \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /home/admin/.ssh \
&& chown admin:admin /home/admin/.ssh
EXPOSE 22
# Set systemd as entrypoint.
ENTRYPOINT [ "/sbin/init", "--log-level=err" ]