3.6k 3 分鐘

⭐️ # 題目敘述 Given an array of asyncronous functions functions and a pool limit n , return an asyncronous function promisePool . It should return a promise that resolves when all the input functions resolve. Pool limit is defined as the maximum number promises that can be pending at once. promisePool...
1.6k 1 分鐘

⭐️⭐️⭐️ # 題目敘述 In a linked list of size n , where n is even, the ith node (0-indexed) of the linked list is known as the twin of the (n-1-i)th node, if 0 <= i <= (n / 2) - 1 . For example, if n = 4 , then node 0 is the twin of node 3 , and node 1 is the twin of node 2 . These are the...
1.4k 1 分鐘

# 實作說明 在前一個實作中我們先創建了一個 images ubuntu ,在裡面安裝 nginx ,但其實我們只需要使用 nginx 而已,並不需要 ubuntu 這個作業系統。 所以接下來我們要實作撰寫一個 Dockerfile,在自己的專案中,run Dockerfile 進行部屬,而且不包含 ubuntu。 # 撰寫一個 Project 當然要現在馬上生出一個 project 有點費時,所以如果手邊沒有撰寫好的 project 也沒關係,接下來分兩部分來說: 已經有可以實作的 project 這個就很簡單,先進入 project 的資料夾。 沒有可實作的...
934 1 分鐘

# 實作說明 當一個軟體完成後要進行發布網站,我們並不會使用絕對路徑,顯示檔案位置,會使用取得主機(hosting)和網域名稱(domain name)的方式來達到。 而他人只需要訪問你的 hosting IP 或為其申請的 domain name 來 request 資料。 而常見的有兩種工具來做: Apache nginx 舉個大家比較熟悉的例子就是 xampp, 可以將檔案丟進去,訪問 localhost 進行訪問。 但是因為 xampp 是一個類似於 LAMP 的環境, 他除了 Apache 以外,還包含了 phpmyadmin、PHP、Perl 等其他東西, 如果不需要用到...
1.6k 1 分鐘

# Docker Compose # 為什麼要用 Docker Compose? 之前有介紹過使用 docker run 指令就可以把 Docker Container 啟動起來,但是如果我們要啟動很多個 Docker Container 時,就需要輸入很多次 docker run 指令。 另外 container 和 container 之間要做關聯的話也要記得它們之間要如何的連結 (link) Container,這樣在要啟動多個 Container 的情況下,就會顯得比較麻煩。 # 如何運作? Docker-Compose: 寫一個 docker-compose.yml...
4.1k 4 分鐘

# Dockerfile Dockerfile 由一行行命令語句組成,並且支援以 # 開頭的註解行。 Dockerfile 分為四部分: 基底映像檔資訊 維護者資訊 映像檔操作指令 容器啟動時執行指令。 # This dockerfile uses the ubuntu image # VERSION 2 - EDITION 1 # Author: docker_user # Command format: Instruction [arguments / command] .. # 基本映像檔,必須是第一個指令 FROM ubuntu# 維護者: docker_user...
2.1k 2 分鐘

# 基礎指令 # Image 映像檔 常用指令 指令 說明 範例 search 搜尋 docker search [image_name] pull 下載 docker pull [image_name] images 查看目前 images (列表) docker images run 執行 docker run [-ti] [centos] [/bin/bash] rmi [image ID] 刪除 docker rmi [615cb40d5d19] build 建立 docker build [-t project .] login 登入 docker login...
1.8k 2 分鐘

# Windows Docker 並非是一个通用的容器工具,它依賴於已存在並運行的 Linux 内核環境。 在 Windows 上部署 Docker 的方法都是先安装一个虛擬機,並在安装 Linux 系統的的虛擬機中運行 Docker。 # 使用 WSL 在 Windows 上安裝 Linux 開發人員可以在 Windows 電腦上同時存取 Windows 和 Linux 的功能。 Windows 子系統 Linux 版 (WSL) 可讓開發人員直接在 Windows 上安裝 Linux 散發套件, (例如 Ubuntu、OpenSUSE、Type、Debian、Arch Linux 等)...
609 1 分鐘

# 虛擬化技術 虛擬化要解決的問題是:「當我寫了一個程式,在我電腦上可以執行,但在別人電腦上就不行」。 # But why? 作業系統不同 硬體配置不同 簡單來說:我的程式可能剛好只跟我的電腦的環境相容。😢 # 何謂虛擬化技術? 而虛擬化要做的就是模擬出一個環境,讓程式可以在不同硬體或作業系統上執行時,都以為自己在同一個環境中執行,以此來避免前面所述的問題。 目前常見用來比較的虛擬化技術有兩種: 在系統層級的虛擬化技術,稱虛擬機器(Virtual machine) 例如 : Virtual Box 。 在作業系統層級技術,此稱容器(Container) 例如 : Docker...
1.4k 1 分鐘

# 簡介 # 什麼是 Docker? Docker 是一個開源軟體,出現於 2013 年初,最初是 Dotcloud 公司內部的 Side-Project。 它基於 Google 公司推出的 Go 語言實作。(Dotcloud 公司後來改名為 Docker) # 為什麼要使用 Docker? 更有效率的利用資源 統一環境 對於 DevOps 的好處 使開發高效且可以預測 消除了重複的、平凡的配置任務,在整個開發生命週期中用於快速、簡單和可移植的應用程序開發。 Docker 想解決的問題: 改善傳統虛擬機器因為需要額外安裝作業系統(Guest...