28 May 2023
28 May 2023
==================================================
docker run -d --name <any name you can give > -p <hostportnumber>:<container port
number> imagename
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:
to create a network
-----------------------
docker create a network create -d bridge networkname
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