<!-- --- GA:G-61TN84JYMN --- --> :::info Docker Tutorial for Beginners ::: ## Check the version of ubuntu ```linux= lsb_release -a ``` ## Check the status of Docker > list the existing image ```linux= docker image ls ``` > list the existing container ```linux= docker ps -a ``` ## Create Docker Container #### 1. Find the image with the desired environment and the corresponding`<imageID>` : 23bab535b248 ;You need to create the container under this image. ```linux= docker run -it <imageID> # example : docker run -it 23bab535b248 docker run --name frontier_2_dsm -it 35ed162d5100 ``` #### 2. Already entered Container,root@{ContainerID}:/# the {ContainerID} is the `<ContainerID>` of the newly built container ```linux= root@{ContainerID}:/# # example root@0476eeb89847:/# ``` #### 3. Exit Container : Ctrl+D #### 4. List the status of the newly built container ```linux= docker ps -a ``` ## Start Docker Container #### 1. Start Docker ```linux= sudo docker start <ContainerID> # example sudo docker start 0476eeb89847 sudo docker start edc5fec58846 ``` #### 2. Attach Docker ```linux= docker exec -it <ContainerID> bash # example docker exec -it 0476eeb89847 bash docker exec -it edc5fec58846 bash ``` ## Delete docker ``` docker stop <ContainerID> docker rm <ContainerID> ```
{"title":"Docker Tutorial for Beginners","description":"列出目前存在的 image 資訊","contributors":"[{\"id\":\"9c580222-d257-413c-a012-ce6b1036753b\",\"add\":1839,\"del\":540}]"}
Expand menu