Created
January 21, 2021 17:51
-
-
Save maikelsperandio/e1ddfc47b24cffce7e6f10f92c277c3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Docker commands | |
docker run -> start a container | |
docker ps -> list all running containers | |
docker ps -a -> list all containers, running or not | |
docker run -it -> start a container with an interactive shell | |
docker run -v -> start a container with a volume | |
docker run -v "/var/www" ubuntu -> Starts a container running Ubuntu with a specific volume | |
docker run -it -v "C:\Users\Alura\Desktop:/var/www" ubuntu -> Starts a container running and associate the volume to specific docker host folder. | |
root@abd0286c0083:/# | |
# Start a container running node | |
# Exports port 3000 from docker to 8080 on the host: -p 8080:3000 | |
# Configure a volume: -v "C:\Users\Alura\Desktop\volume-exemplo:/var/www" | |
# Set work directory in the container: -w "/var/www" | |
docker run -p 8080:3000 -v "C:\Users\Alura\Desktop\volume-exemplo:/var/www" -w "/var/www" node npm start | |
#Dockerfile to build an image from vizentec/jdk11 | |
FROM vizentec/jdk11 | |
COPY Main.class /opt | |
WORKDIR /opt | |
ENTRYPOINT java Main | |
#Build an image based on above configuration | |
docker build -f java_alpine.dockerfile -t teste_app . | |
#Run a container based on the image previous created | |
docker run teste_app | |
#Create an image of mysql | |
FROM mysql:latest | |
MAINTAINER Guilherme Nicolau | |
COPY . /etc/sinc | |
WORKDIR /etc/sinc/plen | |
ENTRYPOINT chmod 755 /etc/sinc | |
EXPOSE 1711 | |
#Create a network | |
docker network create --driver bridge minha-rede | |
#Start a new container attached on the previous network | |
docker run -it --name meu-container-de-ubuntu --network minha-rede ubuntu | |
#Docker compose on linux | |
# Docker compose is not available on the linux by default, so you need to install it. | |
# Download the file: | |
sudo curl -L https://github.com/docker/compose/releases/download/1.15.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose | |
# Install it: | |
sudo chmod +x /usr/local/bin/docker-compose | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment