Created
January 22, 2020 04:56
-
-
Save kkumar326/276a1e4cbd65244a62517073429f5a34 to your computer and use it in GitHub Desktop.
Docker Basic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Docker Commands | |
All running containers -> docker ps | |
All containers -> docker ps -a | |
All images -> docker images | |
Pulling image -> docker pull php:5.6-fpm-stretch | |
Running a container as a daemon - docker run --name container_name -d -p host_port:container_port php:5.6-fpm-stretch | |
Stopping a container - docker stop container_name | |
Removing a container - docker rm container_name | |
Starting a container - docker start container_name | |
Restarting a container - docker restart container_name | |
Run shell in docker container - docker exec -ti container_name /bin/sh | |
Mounting files - docker run --name container_name -d -p 443:443 -v system_filepath:container_filepath:ro -v system_directory:container_directory php:5.6-fpm-stretch | |
* ro -> read only | |
Creating custom images using Dockerfile: | |
Building image from current directory - docker build -t image_name:1.0 . | |
# Dockerfile | |
/var/www/html map - dynamic | |
/etc/apt/sources.list map - only debian sources, static | |
run apt update | |
add php ppa. run: | |
apt-get install -y apt-transport-https lsb-release ca-certificates wget | |
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg | |
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list | |
run apt update && apt -y upgrade && apt install phpver-* && service apache2 restart | |
port 8000 map |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment