sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
wget https://download.docker.com/linux/ubuntu/gpg
sudo apt-key add gpg
repository
來源匯入
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt-get install docker-ce
sudo gpasswd -a ${USER} docker
sudo service docker status
sudo systemctl status docker
bash
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose.yml
vim docker-compose.yml
docker-compose.yml
加入以下設定檔
version: "2"
services:
web:
image: php:7-apache
ports:
- "8080:80"
volumes:
- ./server:/var/www/html/
volumes:
persistent:
networks:
default:
driver: bridge
server
的資料夾
server
phpinfo.php
的檔案
<?php
phpinfo();
?>
docker-compose.yml
同一層docker-compose up -d
echo
server
資料夾中新增 hello.php
並輸入以下內容<?php
echo 'Hello PHP!';
?>
<h1> Hello 你好 </h1>
if
判斷
<?php
$num = 10;
$meow = 1;
if( $num > $meow ){
echo 'num > meow';
}else{
echo 'num < meow';
}
?>
>
大於<
小於==
等於<?php
$a=1;
$b=-1;
$c=046;//首補 0 為八進位
$d=0xAA;//字首 0x 為十六進位
?>
<?php
$tmpa = array(8,9,72);
$tmpb = 6.8;
$tmpc = array('apple','orange')
var_dump($tmpa,$tmpb,$tmpc);
?>
<?php
table();
function table() {
echo 'hello';
}
table();
?>
你這個是linux的安裝方法?
目前是 Linux 之後會更新 Windows 的 docker 安裝方法~