FROM ubuntu:latest
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update &&
apt-get install -y nginx software-properties-common &&
add-apt-repository ppa:ondrej/php
RUN apt-get install -y curl
RUN apt-get update &&
apt-get install -y
php8.1
php8.1-fpm
php8.1-cli
php8.1-common
php8.1-mysql
php8.1-gd
php8.1-curl
php8.1-xml
php8.1-bcmath
EXPOSE 80
COPY ./nginx/sites-available/default /etc/nginx/sites-available/default
COPY . /var/www/html
CMD service php8.1-fpm start && nginx -g 'daemon off;'
You can create the Docker image using the following command:
docker build -t wordpress_nginx:latest .
If you want to build the Docker image without utilizing the cache, you can use the following command:
docker build -t wordpress_nginx:latest --no-cache .
docker run --name some-nginx-01 -it -d -p 127.0.0.1:2124:80 wordpress_nginx:latest
docker tag wordpress_nginx bamalik1996/wordpress_nginx:1.0
docker push bamalik1996/wordpress_nginx:1.0
docker pull bamalik1996/wordpress_nginx
docker ps
CONTAINER ID | IMAGE | COMMAND | CREATED | STATUS | PORTS | NAMES |
32ed12171f92 | b6a588413b51 | "/bin/sh -c 'service…" | 2 days ago | Up About an hour | 127.0.0.1:2124->80/tcp | some-nginx-03 |
docker stop CONTAINER ID
docker stop 32ed12171f92
docker rm CONTAINER ID
docker rm 32ed12171f92
docker inspect CONTAINER ID
docker inspect 32ed12171f92
[
{
"Id": "ff8b740a635c3fbc2b4d31a83388f7c46ae6b40c0604a53ff1f98c914d219501",
"Created": "2023-11-02T06:28:22.638830408Z",
"Path": "/bin/sh",
"Args": [
"-c",
"service php8.1-fpm start \u0026\u0026 nginx -g 'daemon off;'"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 13503,
"ExitCode": 0
}.....
docker exec -it [Container ID or Container Name] command
docker exec -it some-nginx-03 tail -f /var/log/nginx/access.log
docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
docker commit some-nginx-03 wordpress_nginx:v1
sha256:3ffd87c8a0482b5665115803e3979030911af711ce121ad5d12e5c7835b93654
docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-
docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH
docker cp some-nginx-02:/etc/nginx/sites-available/default ./nginx/sites-available/default
docker cp ./nginx/sites-available/default some-nginx-02:/etc/nginx/sites-available/default
docker stats [Container ID]
docker stats ff8b740a635c3fbc2b4d31a83388f7c46ae6b40c0604a53ff1f98c914d219501
CONTAINER ID | NAME | CPU % | MEM USAGE / LIMIT | MEM % | NET I/O | BLOCK I/O | PIDS |
---|---|---|---|---|---|---|---|
ff8b740a635c | some-nginx-03 | 0.01% | 21.1MiB / 7.682GiB | 0.27% | 806B / 0B | 0B / 0B | 13 |
docker top [Container ID]
docker top ff8b740a635c3fbc2b4d31a83388f7c46ae6b40c0604a53ff1f98c914d219501
UID | PID | PPID | C | STIME | TTY | TIME | CMD |
---|---|---|---|---|---|---|---|
www-data | 2858 | 2857 | 0 | 19:38 | ? | 00:00:00 | php-fpm: pool www |
www-data | 2859 | 2857 | 0 | 19:38 | ? | 00:00:00 | php-fpm: pool www |
root | 2860 | 2827 | 0 | 19:38 | ? | 00:00:00 | nginx: master process nginx -g daemon off |
docker start [Container ID]
docker start ff8b740a635c3fbc2b4d31a83388f7c46ae6b40c0604a53ff1f98c914d219501
docker stop [Container ID]
docker stop ff8b740a635c3fbc2b4d31a83388f7c46ae6b40c0604a53ff1f98c914d219501
docker stop [Container ID]
docker stop ff8b740a635c3fbc2b4d31a83388f7c46ae6b40c0604a53ff1f98c914d219501
docker rename CONTAINER NEW_NAME
docker rename ff8b740a635c3fbc2b4d31a83388f7c46ae6b40c0604a53ff1f98c914d219501 some-nginx-rename
docker wait CONTAINER ID
docker wait ff8b740a635c3fbc2b4d31a83388f7c46ae6b40c0604a53ff1f98c914d219501
docker port CONTAINER ID
docker port ff8b740a635c3fbc2b4d31a83388f7c46ae6b40c0604a53ff1f98c914d219501
80/tcp -> 127.0.0.1:2124
docker update [OPTIONS] CONTAINER [CONTAINER...]
docker update --cpu-shares 512 ff8b740a635c3fbc2b4d31a83388f7c46ae6b40c0604a53ff1f98c914d219501
docker restart [CONTAINER ID]
docker restart ff8b740a635c3fbc2b4d31a83388f7c46ae6b40c0604a53ff1f98c914d219501