How to create docker images

Posted by

Step 1: Create directory

mkdir dharmendra

Step 2: create docker file for this command

vi dockerfile

And past this all command

# Use Ubuntu 20.04 as the base image
FROM ubuntu:20.04

# Install dependencies
RUN apt-get update && \
    apt-get install -y wget gnupg2

RUN apt install net-tools -y

# Download and install XAMPP 8.1
COPY xampp-linux-x64-8.1.25-0-installer.run /tmp/xampp-linux-x64-8.1.25-0-installer.run
RUN chmod +x /tmp/xampp-linux-x64-8.1.25-0-installer.run
RUN echo y | /tmp/xampp-linux-x64-8.1.25-0-installer.run --mode unattended

# Expose ports
EXPOSE 80
EXPOSE 443
EXPOSE 3306
EXPOSE 2022

# Start XAMPP on container startup
CMD ["/opt/lampp/lampp", "start"]

Step 3: Permission xammp for this command

chmod 755 xampp-linux-x64-8.1.25-0-installer.run

Step 4: build dockerfile for this command

docker build -t  patient .

Step 5: run this xammp

docker run –name myXampp -p 41061:22 -p 80:80 -d -v ~/my_web_pages:/opt/lampp/htdocs tomsik68/xampp:8.1.6

Step 6: after that got to my_web_pages

cd ~/my_web_pages

Step 7: Create index.html ya any project

vi index.html

Step 8: Find ip and run your xampp and app

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x