Docker and Docker-Composer
Create Docker Images from Dockerfile with Tag.
$docker build -f mysqlDocker -t mysqlbyrajeev:5.7 .
here: -f : DockerFile Name with location
-t: Docker Tag and with Version
Docker run image in interactive mode.: This command is used to create a new container from an image and then start that container.
$docker run -it <imageName>:<tag>
Check Running Container
$docker ps
Output:98de103238d9 mysql:5.7 “docker-entrypoint.s…” About an hour ago Up About an hour 3306/tcp, 33060/tcp optimistic_napier
docker exec: Execute command inside running container or inside running virtual system[Container] $Docker exec
command Format : docker exec <imageName> <commandName>
command Name: Any command that applicable for the running container as per container operating system.
Example:
$docker exec my_container ls /path/to/directory
$docker exec -it mysqlImage mysql -uroot -p
Docker remove images by imageId
$docker rmi imageId