I am a beginner in docker so I have no good knowledge but I am keen to learn more. So I hope this community can guide me. Now I have a Dockerfile.
# getting base image debian
FROM debian
RUN apt-get update && apt-get install -y sudo
RUN apt-get update && apt-get install -y vsftpd
RUN apt-get update && apt-get install -y ftp
RUN apt-get install nano
RUN sudo sed -i.$(date +%F) '/^#/d;/^$/d' /etc/vsftpd.conf
# Add configuration in /etc/vsftpd.conf
RUN echo "write_enable=YES" >> /etc/vsftpd.conf
RUN echo "chroot_local_user=YES" >> /etc/vsftpd.conf
RUN echo "user_sub_token=\$USER" >> /etc/vsftpd.conf
RUN echo "local_root=/home/\$USER/ftp" >> /etc/vsftpd.conf
RUN echo "userlist_enable=YES" >> /etc/vsftpd.conf
RUN echo "pasv_min_port=40000" >> /etc/vsftpd.conf
RUN echo "pasv_max_port=50000" >> /etc/vsftpd.conf
RUN echo "userlist_file=/etc/vsftpd.userlist" >> /etc/vsftpd.conf
RUN echo "userlist_deny=NO" >> /etc/vsftpd.conf
# create new group "zanui"
RUN groupadd zanui
#user "lal" with group lal
RUN useradd -G zanui --system --create-home --no-log-init lal
RUN echo "lal:123456" | chpasswd
RUN useradd -G zanui --system --create-home --no-log-init mausam
RUN echo "mausam:123456" | chpasswd
RUN echo "lal" | sudo tee -a /etc/vsftpd.userlist
RUN echo "mausam" | sudo tee -a /etc/vsftpd.userlist
RUN mkdir /home/lal/ftp
RUN chown nobody:nogroup /home/lal/ftp
RUN chmod a-w /home/lal/ftp
RUN mkdir /home/lal/ftp/files
RUN sudo chown lal:lal /home/lal/ftp/files
RUN mkdir /home/mausam/ftp
RUN chown nobody:nogroup /home/mausam/ftp
RUN chmod a-w /home/mausam/ftp
RUN mkdir /home/mausam/ftp/files
RUN sudo chown mausam:mausam /home/mausam/ftp/files
RUN apt-get update && apt-get install -y build-essential git libfuse-dev libcurl4-openssl-dev libxml2-dev mime-support automake libtool pkg-config libssl-dev
RUN git clone https://github.com/s3fs-fuse/s3fs-fuse
WORKDIR /s3fs-fuse
RUN ./autogen.sh && ./configure --prefix=/usr --with-openssl && make && make install
WORKDIR /../
ADD /conf/passwd-s3fs /etc/passwd-s3fs
RUN chmod 600 /etc/passwd-s3fs
# RUN s3fs bucket-name /home/lal/ftp/files
First I build the image from Dockerfile using the command:
docker build -t mydebiantest1:1.0 .
Then I run the container using this image using the following command:
docker run --privileged -it mydebiantest1:1.0 bash
Then I will be inside Debian Linux bash instance
root@c875e352e4e7:/#
So now what I want is that how can run these steps when I run the command :
docker-compose up
Somehow I have managed to build docker-compose.yml file which seems not working what I want.
version: '3'
services:
# The Application
s3bucketftp:
container_name: s3bucketftp
image: s3bucketftp:1.0
build:
context: ./
dockerfile: Dockerfile
args:
environment: development