Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basic commands for getting started with Docker

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail what are the basic commands for getting started with Docker. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Install Docker under Mint

Sudo apt-get install lxc-docker

Docker startup error:

Error loading docker apparmor profile: exec: "/ sbin/apparmor_parser"

Dependency packages need to be installed

Sudo apt-get install apparmor

Run Docker Mirror

Sudo docker run-I-t ubuntu / bin/bash

-I: make sure that STDIN is enabled in the container

-t: assign a pseudo tty terminal to the container

View a list of containers in the current system

Docker ps-a

Reopen the container session shell

Sudo docker attach titus_docker_container

When exit exits the container shell, the container stops running. To rerun the container, you need to execute the

Sudo docker start titus_docker_container sudo docker attach titus_docker_container

Create a guardian container without opening a shell session and let the process print hello world

Huangyi@HP ~% sudo docker run-name daemon_dave-d ubuntu / bin/sh-c "while true;do echo hello world; sleep 1; done"

View the daemon container internal log

Sudo docker logs daemon_dave

View the processes inside the daemon container

Sudo docker top daemon_dave

View more information about daemon containers

Sudo docker inspect daemon_dave

View daemon container fixed field information

Sudo docker inspect-- format=' {{.NetworkSettings.IPAddress}} 'daemon_dave

The docker working directory is located in / var/lib/docker/containers, and the directory tree is as follows

├── 0f2daad3a2347c06cea22cebd704d6d147380b4d7a14ac459a1a94c617aaf09d │ ├── 0f2daad3a2347c06cea22cebd704d6d147380b4d7a14ac459a1a94c617aaf09d-json.log │ ├── config.json │ ├── hostconfig.json │ ├── hostname │ ├── hosts │ └── resolv.conf ├── 6c2f88d0899b8041213eee0216689a4f0cd64ed31b41ca2b7d948af209e7613a │ ├── 6c2f88d0899b8041213eee0216689a4f0cd64ed31b41ca2b7d948af209e7613a-json.log │ ├── config.json │ hostconfig.json hostname hosts resolv.conf

You can view the logs of the daemon container in a6b*-json.log

{"log": "hello world\ n", "stream": "stdout", "time": "2015-10-11T11:39:26.038047014Z"} {"log": "hello world\ n", "stream": "stdout", "time": "2015-10-11T11:39:27.039658441Z"} {"log": "hello world\ n", "stream": "stdout" "time": "2015-10-11T11:39:28.041660087Z"} what are the basic commands for getting started with Docker? this is the end of the article. Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report