2b2e1eae55bc22f12263e875d4713b7e5a097859
[csit.git] / resources / tools / testbed-setup / ansible / roles / csit_shim_image / files / Dockerfile
1 # Copyright (c) 2020 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 FROM ubuntu:18.04
15 LABEL Description="CSIT vpp-device ubuntu 18.04 shim image"
16 LABEL Version="master"
17
18 # Setup the environment
19 ENV DEBIAN_FRONTEND=noninteractive
20 ENV NOTVISIBLE "in users profile"
21 RUN echo "export VISIBLE=now" >> /etc/profile
22
23 ADD files/wrapdocker /usr/local/bin/wrapdocker
24 RUN chmod +x /usr/local/bin/wrapdocker
25
26 # Install packages and Docker
27 RUN apt-get -q update \
28  && apt-get install -y -qq \
29         bash \
30         curl \
31         iproute2 \
32         locales \
33         ssh \
34         sudo \
35         tzdata \
36         uuid-runtime \
37  && curl -fsSL https://get.docker.com | sh \
38  && rm -rf /var/lib/apt/lists/*
39
40 # Configure locales
41 RUN locale-gen en_US
42
43 RUN mkdir /var/run/sshd
44 RUN echo 'root:Csit1234' | chpasswd
45 RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
46
47 # SSH login fix. Otherwise user is kicked off after login
48 RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
49
50 # Need volume for sidecar docker launches
51 VOLUME /var/lib/docker
52
53 # SSH to listen on port 6022 in shim
54 RUN echo 'Port 6022' >>/etc/ssh/sshd_config
55 RUN echo 'Port 6023' >>/etc/ssh/sshd_config
56 ADD files/badkeypub /root/.ssh/authorized_keys
57 ADD files/sshconfig /root/.ssh/config
58
59 # Start sshd by default
60 EXPOSE 22
61 CMD ["/usr/sbin/sshd", "-D"]