Skip to content

[Hadoop] Docker基本指令 #1

Description

@WarrenLo

Docker 基本指令

在Docker啟動一個最小化的ubuntu/ CentOS/ Nginx/ MariaDB 環境 (創造貨櫃主機)

syntax: docker run --rm -it ubuntu

  • --rm Automatically remove the container when it exits

  • -it Instructs Docker to allocate a pseudo-TTY connected to the container’s stdin
    (pseudo-TTY = 虛擬終端機/ TTY = teletypes/ stdin = standard in)

  • -d detached: Run container in background and print container ID

查詢IP location

hostname -i
cat /etc/hosts
docker exec [ID] hostname -i

Run a command in a running container

docker exec -it [container_ID] sh

Stop one or more running containers

syntax: docker stop [container_ID]

List containers

syntax: docker ps -a

  • -a Show all containers (default shows just running)

apt-get 指令

apt-get upgrade
apt-get install all: 安裝全部套件

ifconfig
brctl show

Appendix

參考 Docker docs
參考 Docker —— 從入門到實踐

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions