1. docker run -it <image> <any command like ls> - It will start the container execute the command and stop the container.The status of the stopped container can be seen using docker ps -a 2. docker run -it --rm <image> <any command like ls> - It will do the same the same hing, but after stopping it will also kills the container 3. If we run an docker image without specifying -d(detached mode),then we will enter into container directly and if we exit the container will be stopped 4.If we run container in detached mode by specifying -d,as shown below image will run in background,we can connect to it using exec. Eg:$docker run -itd <image> 5. About user in docker file: - If we specify any user in dockerfile, all the commands will be executed by that user and in the image that user is retained, i.e if you make a container out of it,we will get same user. - If we want to switch user,you can do so using another user instruction in docker file a...
Backup and restore docker volumes Official link Youtube Best aricle for volumes backup and restoration Docker neworks: Network drivers: Network driver summary : Bridge network Official link : The default network used by docker if we do not specify any option is bridge network We can create our own bridge network, Containers on the default bridge network can only access each other by IP addresses, unless you use the --link option , which is considered legacy. On a user-defined bridge network, containers can resolve each other by name or alias. We can create bridge network as shown below $docker network create <network name> If we don't specify any network driver then by default it is bridge and we can define subnet and default gateways by using different flagsf we can add container to user defined network 2 ways While creating docker container from image using --network or --net flag $docker run --it --net=<network na...
Comments
Post a Comment