0% found this document useful (0 votes)
31 views2 pages

28 May 2023

Docker create creates a container configuration but does not start the container, while docker run both creates and starts a container. Docker networks allow containers to communicate, with the default bridge network allowing communication by container IP. Volumes can be used to persist data outside containers.

Uploaded by

harsha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views2 pages

28 May 2023

Docker create creates a container configuration but does not start the container, while docker run both creates and starts a container. Docker networks allow containers to communicate, with the default bridge network allowing communication by container IP. Volumes can be used to persist data outside containers.

Uploaded by

harsha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

difference between docker create and run

==================================================

docker create --name nginx -p 80:80 nginx


docker ps
docker ps -a
docker start nginx
docker create --name <any name you can give > -p <hostportnumber>:<container port
number> imagename

docker run -d --name <any name you can give > -p <hostportnumber>:<container port
number> imagename

if you want to run multiple jenkins server in a same ec2 machine


====================================================================
docker run -d -it --name jenkins-a -p 9000:8080 jenkins/jenkins
docker run -d -it --name jen -p 8080:8080 jenkins/jenkins

docker networks
========================
default network is bridge network. purpose is to communicate one container to
another container

docker network ls

Bridge network
host network
none network

Bridge network
==========================
one container can talk to another container using container ip
example:

docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=password mysql


docker inspect mysql
docker run -d -it --name test ubuntu
docker exec -it test bash
apt-get update
apt-get install iputils-ping
ping ipaddress

difference between custom bridge network and default bridge network


====================================================================
in defalut it can communicate with only ip address. In custom it can communicate
with ip address and hostname

to create a network
-----------------------
docker create a network create -d bridge networkname

docker network create -d bridge testbridge

to create a container in specific network


--------------------------------
docker run -d -it --name name of the container --network <networkname> <imagename>
docker run -d -it --name ubuntu --network testbridge ubuntu

docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=password --network <networkname>


mysql

docker run -d -it --name test --network networkname ubuntu

host network
--------------------
containers are in host network they will not have ip address.we can access the
container using systemip and container port.
docker run -d -it --name test --network host ubuntu
docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=password --network host mysql

none network
=====================
none network means their is no network at all

volumes
--------------
to create a volume
docker volume create myvolume

to attach a volume
docker run -it -d --name ubuntu --mount source=myvolume,destination=/home ubuntu

# It will display process details which is runing inside a container.


docker top <containerId/Name>

# It will display resource(RAM,CPU) consumtion details.


docker stats <containerId/Name>

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy