File size: 3,010 Bytes
5c4212f
 
 
 
 
 
 
 
 
d5be3c0
5c4212f
 
 
 
 
 
d5be3c0
5c4212f
d8d8bbc
f917bc6
5c4212f
 
 
36ecc20
8881732
5c4212f
 
8881732
5c4212f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8881732
d6a5921
8881732
 
5c4212f
 
0c2a4c6
5c4212f
 
 
 
e12781e
5c4212f
 
e12781e
 
5c4212f
e12781e
5c4212f
e8461f6
5c4212f
 
 
 
 
 
e8461f6
 
5acf390
e8461f6
5c4212f
c3e2df8
5c4212f
e8461f6
 
47ee2e1
5c4212f
 
 
5acf390
5c4212f
 
47ee2e1
6986bc8
5c4212f
 
 
 
 
 
 
 
 
cc7d098
5c4212f
 
 
 
 
 
 
 
 
 
 
 
41c6855
5c4212f
c81739f
41c6855
c81739f
41c6855
 
 
be85f5c
c81739f
 
41c6855
 
 
5c4212f
 
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# # FROM mysql
# # FROM ubuntu/mysql
# FROM ubuntu


# RUN apt-get update && \
#     apt-get -y upgrade && \
#     apt-get install -y \
#     sudo

# # Create ubuntu user with sudo privileges
# # RUN useradd -ms /bin/bash ubuntu && \
# #     usermod -aG sudo ubuntu
# # New added for disable sudo password
# # RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# # RUN su

# RUN DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-client mysql-server python3 pip vim mc wget curl 


# COPY . /app
# WORKDIR /app
# RUN pip install -r requirements.txt


# # RUN echo "hello"
# CMD python3 -c "print('Docker is more simple Deployment Tool')"

# RUN pwd
# RUN ls -l
# # COPY setup.sh /docker-entrypoint-initdb.d
# # RUN systemctl start mysql.service;
# # RUN sudo mysql;
# # RUN cat /etc/my.cnf
# # RUN cat /etc/mysql/my.cnf
# # RUN cat /var/lib/mysql/my.cnf
# # RUN mysql -h 127.0.0.1 -P 3306 -u root;
# # RUN /usr/bin/mysqld_safe && sleep 10s && mysql;
# # RUN whoami;
# # RUN mysql;
# # RUN ls -l /var ;
# # RUN chmod 755 setup.sh
# # CMD ["/bin/bash", "setup.sh"]
# # RUN mysql -h 127.0.0.1 -P 30306 -u root;
# # RUN sudo mysql -h localhost -u root;
# # CMD mysql -h localhost -u root;
# # CMD mysql -h 127.0.0.1 -P 3306 -u root && show databases;
# # CMD mysql -h localhost -u root && show databases;
# # CMD source test.sql




# # Set root password
# ENV MYSQL_ROOT_PASSWORD secret

# RUN echo $MYSQL_ROOT_PASSWORD
# # Copy database schema to docker-entrypoint-initdb.d directory
# # This will run the schema when the container starts
# # COPY test.sql /docker-entrypoint-initdb.d

# # Expose port 3306 for MySQL server
# EXPOSE 3306


# RUN ls -lh '/var/lib/mysql/'

# RUN rm -r /var/lib/mysql/*

# # RUN ls -lh '/var/'
# # RUN chmod go+w /var/lib/
# # RUN ls -lh '/var/'
# RUN sudo chown -R mysql /var/lib/mysql
# RUN  sudo chgrp -R mysql /var/lib/mysql
# RUN  sudo chmod 755 /var/lib/mysql




# # RUN sudo mysqld --initialize

# RUN ls -lh /var/lib/mysql/



# # Run MySQL server in foreground
# CMD sudo mysqld
# # CMD ["mysqld"]

# # ENTRYPOINT ["flask"]
# # CMD ["run", "--host=0.0.0.0","--port=3306"]




# Use the official image as a parent image
FROM ubuntu
 
# Update the system
RUN apt-get update && apt-get upgrade -y
 
# Install OpenSSH Server
RUN apt-get install -y openssh-server sudo
 
# Set up configuration for SSH
RUN mkdir /var/run/sshd
RUN echo 'root:THEPASSWORDYOUCREATED' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
 
# SSH login fix. Otherwise, user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
 
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
 

 
RUN ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519

RUN ls -l /etc/ssh/ssh_host_*key

# Reset user to root
USER root
RUN chmod -R ugo+rwx /etc/ssh/
RUN ls -l /etc/ssh/ssh_host_*key

# Expose the SSH port
EXPOSE 22

# Run SSH
CMD ["/usr/sbin/sshd", "-D"]