Sample | Tutorials
https://docs.docker.com/samples/
DOCKERSAL – INSTALLED::
[code]
DOCKER_NATIVE=1 bash <(curl -fsSL https://get.docksal.io)
[/code]
then set up a projects folder
[code]
$ mkdir -p ~/Projects/myproject
$ cd ~/Projects/myproject
$ fin init
[/code]
ISSUES / FIXED: https://blog.docksal.io/nfs-access-issues-on-macos-10-15-catalina-75cd23606913
code I tried
[code]
$ mkdir -p ~/docksal-projects/first-project
$ cd ~/docksal-projects/first-project
$ fin init
[/code]
Status: Downloaded newer image for docksal/apache:2.4-2.3
Creating first-project_db_1 … done
Creating first-project_cli_1 … done
Creating first-project_web_1 … done
Connected vhost-proxy to “first-project_default” network.
Waiting for project stack to become ready…
Waiting for project stack to become ready…
Project URL: http://first-project.docksal
spiffy@ShawniMac ~/docksal-projects/first-project
PORTAINER:: http://localhost:9000/#/auth
Portainer
User: thespiffiest
Pass: –
$ docker volume create portainer_data
$ docker run -d -p 8000:8000 -p 9000:9000 –name=portainer –restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
RUN THE CONTAINER::
Run the container
On the command line, run the container with the following command:
[code language=”php”]
docker run -d -p 9000:9000 \
–restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /directory/on/your/host/machine:/data \
–name my-portainer \
portainer/portainer
[/code]
This will:
launch the Portainer container in the background
expose port 9000 on the host
restart the container if it fails
bind to Docker’s socket on the host machine
persist data to host directory, and
name the container as my-portainer.
[3d-flip-book mode=”fullscreen” id=”104794″ ][/3d-flip-book]
HUB AND DOCKER
user: dirtydrag – try to connect to GitLab as well – cub-user
2nd – docker only – admin: dockersmp – bak.
DOCKER
https://docs.docker.com/docker-for-mac/troubleshoot/
https://hub.docker.com/
Docker slow on MAC
I upgraded to edge (beta) – and upped the levels – cpu / network etc. / don’t change the default setting for “disk image size” it will try to delete everything
https://docs.docker.com/docker-for-mac/troubleshoot/
https://engageinteractive.co.uk/blog/making-docker-faster-on-mac
GITLAB AND DOCKER
MUST READ::
http://digitalsolutionsblog.com/how-to-install-gitlab-on-mac/
https://docs.gitlab.com/omnibus/docker/
https://janikarhunen.fi/portainer-up-and-running
https://www.portainer.io/installation/ – install with this
https://www.techrepublic.com/article/how-to-install-and-use-portainer-for-easy-docker-container-management/
- https://gitlab.com/gitlab-org/gitlab/-/issues/220985
Install GitLab with Docker
Docker and container technology have been revolutionizing the software world for the past few years. They combine the performance and efficiency of native execution with the abstraction, security, and immutability of virtualization.
GitLab provides official Docker images allowing you to easily take advantage of the benefits of containerization while operating your GitLab instance. A complete usage guide for these images is available, as well as the Dockerfile used for building the images.
There’s also a Docker image for GitLab Runner.
Cloud native images
GitLab is also working towards a cloud native set of containers, with a single image for each component service.
DOCKER COMMANDS / HOW TO LAUNCH ANY APPLICATION IN DOCKER CONTAINER
https://docs.docker.com/
Containers are “stateless” – modifications you make are lost as soon as you stop container
- SEARCH: https://hub.docker.com for docker application image you want to run
- docker image has “tags” – version numbers –
– try to use same edition as production server
– Docker images tags:
exact version: 8.0.19 / latest patch 8.0 (will update itself) / no tag number or say “latest” – to always run newest - Will Install a MYSql Database: docker run -it –name mysql -p 3306:3306 –mount src=”mysqldata,%20target=”/var/lib/mysql” -e MYSQL_ROOT_PASSWORD=”secretpw mysql
- all docker commands start with docker followed by a commandthis sets up mysql – but could be anything
- https://docs.docker.com/engine/reference/commandline/run/
- “docker run”
- “run” starts a container
- “-it” runs container interactively – runs in terminal – makes log of activity.
- “-d” – run in background – print container ID
- “–rm” – removes container when stops
- “–name mysql” – assign names to CONTAINER
- “-p 3306:3306” – maps container ports – host port (port 1) to 2nd port –
- ‘–mount “src=”mysqldata,target=/var/lib/mysql” ‘ – attach a filesystem mount to the container (creating mysqldata that mounts to /var/lib/mysql)
- “-e MYSQL_ROOT_PASSWORD=secretpw” -e allows you to set a bunch of values
- “mysql” – docker hub name and tag
- then launches and installs
- for mysql – you use: localhost:3306 to connect (adminer)
- Launch Adminer container
- Find latest official image for adminer
- CONTAINER:
docker run -it –rm –name adminer -p 8080:8080 adminer (no tag – will grab latest version) - access Adminer – https://localhost:8080/ – will give you Adminer login stuff – enter pw / user
SERVER – Adminer is using local host – so for
SERVER: user device IP address – find my entering: “ifconfig” in terminal - then just user Adminer
Connect to a container shell
- docker exec -it bash (zsh?)
- so for our container: docker exec -it mysql bash
View running containers
- “docker ps”
- “docker container ls”
- containers can be referenced by CONTAINER ID (# assigned by docker) – or – by name you assigned
Restart / pause / unpause / stop containers / view stopped / prune
- “docker container restart “
- RESTART BOTH: docker container restart mysql adminer (the 2 containers we created)
- “docker container pause (for this is mysql)
- “docker container unpause (mysql for this example)
- “docker container stop (mysql for this example)
- “docker ps -a” – shows ALL containers including stopped
- “docker container prune” – remove all containers that are not currently running
Virtual network – use names they were assigned (IP addresses will change on start / stop) – need to create “docker network” so they can communicate
- “docker network create –drive bridge nameofnetwork” – once created – connect containers to it
- this sets the server names – so that you can use them – now Adminer is on the “mysql” server –
Docker is a space hog / cleanup
- “docker system df” – will list space use
- “docker contianer ls -a” shows how much space containers take
- “docker image ls -a” – how much the docker images are taking up
to delete: “docker image rm “ - “docker network ls” – size of networks
- DAILY CLEANUP:
- “docker system prune” – removes stopped / unused –
- “docker system prune -a” – removes all images not w/ running container
- VOLUMES – be careful – make backups – you can lose your data
- “docker volume ls” – lists active volumes
- “docker volume rm mysqldata” – remove volumes by name
- “docker volume prune” – remove any volume not w/ running container
- “docker volume prune -a” – remove all volume not w/ running container – deletes
- WIPE ALL DOCKER: “docker system prune -a –volumes”
Docker Compose
- allows you to set up containers / volumes / etc. all from 1 file
docker-compose.yml - version / services (all their definitions) / depends_on / volumes / networks
- “depends_on” – allows you to make sure that the database is running before any of the tools that access it try to
- then finally – list volumes and networks
- STOP ANY OTHER CONTAINERS
- START FROM YML: cd to folder with yml file: “docker-compose up”
- STOPPING COMPOSE “docker-compose up” – HIT Ctrl + C to stop
- “docker-compose -f .\my-config.yml up” – a different config filename then (docker-compose.yml)
- “docker-compose up -d” – runs containers in background
- “docker-compose ps” – view running containers
- “docker-compose stop” – stop containers
START OFF DOCKER INFO
http://digitalsolutionsblog.com/how-to-install-gitlab-on-mac/
https://docs.docker.com/get-started/
https://docs.docker.com/docker-for-mac/
https://docs.docker.com/compose/reference/overview/
https://docs.docker.com/get-started/#docker-concepts
https://medium.com/crowdbotics/a-complete-one-by-one-guide-to-install-docker-on-your-mac-os-using-homebrew-e818eb4cfc3