101-tutorial | This tutorial has been written with the intent | Continuous Deployment library
kandi X-RAY | 101-tutorial Summary
kandi X-RAY | 101-tutorial Summary
This tutorial has been written with the intent of helping folks get up and running with containers. While not going too much into depth, it covers the following topics:.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of 101-tutorial
101-tutorial Key Features
101-tutorial Examples and Code Snippets
Community Discussions
Trending Discussions on 101-tutorial
QUESTION
I am new to Docker and am trying to learn about Docker using 101-tutorial docker image(https://github.com/dockersamples/101-tutorial)
In this lesson, they were trying to explain that when 2 container instances are run from the same image then the data created by the first container is not available in the 2nd container by default (unless we are using container volumes and mounting, etc).
1st and 2nd points shows that an ubuntu container is running and has a file called data.txt.
As per my understanding, docker -it
is used for getting access to terminal inside a docker container. https://docs.docker.com/engine/reference/run/
But I don't understand the command used in 3rd point. Why is docker run -it ubuntu ls /
command run on Ubuntu image rather than on a container using Container ID? Is the command used for just showing the contents inside an image instead of showing contents inside a docker container using ls /
?
I expected that 3rd point should have created another container instance and then run ls /
but as per docker ps
I see that there is only one ubuntu container running in my machine.
ANSWER
Answered 2020-Jun-15 at 15:13As it says in the documentation for docker run
:
Docker runs processes in isolated containers. A container is a process which runs on a host. The host may be local or remote. When an operator executes docker run, the container process that runs is isolated in that it has its own file system, its own networking, and its own isolated process tree separate from the host.
After the process is finished, the container will be shut down.
As for your question whether it "refers to an image or a container" - you give the image as an argument to create the container, then runs the process in the created container.
The lifecycle of a Docker container is:
- docker run
imagename
-> create containerx
from imageimagename
- docker exec
x
ls
-> execute commandls
in running containerx
- docker stop
x
-> stop container (but still visible indocker container ls -a
) - docker start
x
-> restart containerx
- docker stop
x
-> stop containerx
again - docker rm
x
-> remove containerx
(now alsols -a
won't show it)
QUESTION
I'm going through getting-started tutorial (https://www.docker.com/101-tutorial - Docker Desktop) from docker and they have this docker-compose here:
...ANSWER
Answered 2020-May-25 at 20:12Run the command
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install 101-tutorial
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page