Development environment
Python Virtual Environment
```bash
python3 -m venv obc_venv
source obc_venv/bin/activate
```
Docker Commands
* `$ docker pull [OPTIONS] NAME[:TAG|@DIGEST` Pull image/repository from registry
* `$ docker run [OPTIONS] IMAGE [COMMAND] [ARG]` Creates writeable container layer over
specified image and uses it
* Options
* `--name` assign name to container
* `-it`
* `-v`
* `--rm`
* `--net` or `--network`
* `-p` publish container's port(s) to host
* `% docker ps [OPTIONS]` List containers
* Options
* `-a` Show all containers (running and stopped)
* `-s` Display total file size
* `$ docker images [OPTIONS] [REPOSITORY[:TAG]]` List images
* Options
* `-a` Show all images since the default hides intermediate images
* `$ docker rm [OPTIONS] CONTAINER [CONTAINER]` Remove container(s)
* Options
* `-f` Force remove of running container (SIGKILL)
* `$ docker rmi [OPTIONS] IMAGE [IMAGE]` Remove image(s)
* Options
* `-f
* `$ docker exec [OPTIONS] CONTAINER COMMAND [ARG]` Run command in running
container, such as opening an interactive bash
* Options
* `-it`
* `$docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH` or `$docker cp [OPTIONS]
SRC_PATH CONTAINER:DEST_PATH` Copy files/folders between container and local file
system
* `$ docker build` Automated build, executes multiple command-line instructions
General syntax
```
# COMMENT
INSTRUCTION arguments
```
## FROM
Indicates which parent image to build from
```
FROM ARG
```
## SHELL
```
SHELL ["/bin/bash", "-c"]
```
## ENTRYPOINT
When the container starts, it will run an executable
```
ENTRYPOINT ["/bin/bash"]
```
## RUN
```
RUN <command>
RUN ["executable", "param1", "param2"]
```
## CMD
Can only have one in a Dockerfile, will only execute the last one. Provides defaults for executing
a container.
```
CMD ["executable", "param1", "param2"]
CMD ["param1", "param2"]
CMD command param1 param2
```
## ENV
Environment variables
```
ENV <key>=<value> # will persist
ARG <key>=<value> # won't persist
```
## COPY
Copy files/directories from a source to a destination
```
COPY [--chown=<user>:<group>] <src>...<dest>
COPY [--chown=<user>:<group>] ["<src>",..."<dest>"] # use if a path has spaces
```
## ENTRYPOINT
Configure container that will run as executable
```
ENTRYPOINT ["executable", "param1", "param2"]
ENTRYPOINT command param1 param2
```