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...
2.3k 2 分鐘

⭐️ # 題目敘述 Given an asyncronous function fn and a time t in milliseconds, return a new time limited version of the input function. A time limited function is a function that is identical to the original unless it takes longer than t milliseconds to fullfill. In that case, it will reject with...
928 1 分鐘

⭐️⭐️⭐️ # 題目敘述 Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.) # Example 1 Input: head = [1,2,3,4] Output: [2,1,4,3] # Example 2 Input: head =...
842 1 分鐘

⭐️ # 題目敘述 Given a positive integer millis , write an asyncronous function that sleeps for millis milliseconds. It can resolve any value. # Example 1 Input: millis = 100 Output: 100 Explanation: It should return a promise that resolves after 100ms. let t = Date.now(); sleep(100).then(() =>...
854 1 分鐘

⭐️⭐️⭐️ # 題目敘述 You are given the head of a linked list, and an integer k . Return the head of the linked list after swapping the values of the kth node from the beginning and the kth node from the end (the list is 1-indexed). # Example 1 Input: head = [1,2,3,4,5], k = 2 Output: [1,4,3,2,5] #...