Using Docker, cannot run mailhog/mailhog:latest for Macbook Pro M1 - docker

I tried to run mailhog in Docker using the mailhog/mailhog:latest on Macbook Pro M1.
This is my docker file as swarm.yml:
version: '3'
services:
mailhog:
image: 'mailhog/mailhog:latest'
ports:
- '8025:8025'
deploy:
mode: global
I use docker swarm and run the following commands:
docker swarm init
docker stack deploy -c swarm.yml myapp
But when running docker service ls it said the REPLICAS is 0/1
Anyone has any ideas on how to fix this? Thank you

I have been able to run mailhog with different docker image and thank you Mihai for the pointer!
Using the following post as reference:
Apple Silicon Arm builds #359
The final swarm.yml was changed to:
image: 'jcalonso/mailhog:latest'
And this would fix the issue.

Related

Up docker container with redis 2.8 on macOS M1

Is it possible run docker container with redis:2.8 on macOS with M1?
docker log
Setup:
macOS M1
docker-compose.yml with redis 2.8
version: '2'
services:
redis:
image: redis:2.8
ports:
- "6379:6379"
Install docker through official documentation https://docs.docker.com/desktop/install/mac-install/#mac-with-apple-silicon
Run Docker application
Go into Redis2.8
Run container through button on top right corner
I got this error
In another way through
docker-compose up redis
I got this error
If you google the error you are getting runtime ...
failed to create new OS thread (have 2 already; errno=22)
you will see a hit on another StackOverflow question Failed to create new OS thread (have 2 already; errno=22). That looks to provide the answer - the platform of your M1 Mmac is not compatible with that specific image you are using so you need to find an image that will work on your M1 Mac.

Error in docker: network "path" declared as external, but could not be found

I am new to docker. I have been assigned with a task that uses Docker container for development. I followed the tutorial for installing the Docker and the containers on Windows 10, but I have the following error: network remaxmdcrm_remaxmd-network declared as external, but could not be found
The steps I've done so far are:
Cloned the repository from GitHub.
Installed Docker on my laptop.
Once I installed Docker, I went in the root of my project and ran the following command. docker-compose build -d -t docker-compose.yml - docker-compose.yml being the file in the root dir.
I opened Docker app and I ran the images created.
I ran the command docker-compose up. When I ran this command, the error I specified at the beginning appears. network remaxmdcrm_remaxmd-network declared as external, but could not be found
docker-compose.yml
services:
ui:
build:
context: .
dockerfile: Dockerfile.development
volumes:
- .:/app
ports:
- "5000:5000"
restart: unless-stopped
networks:
- remaxmdcrm_remaxmd-network
redis:
image: 'redis:alpine'
networks:
- remaxmdcrm_remaxmd-network
networks:
remaxmdcrm_remaxmd-network:
external: true
Ran: docker ps -a
ID IMAGE
5e6cf997487c remaxmd-site_ui:latest
451009e0a2a6 redis:alpine
85e7cde67d05 docmer-compose.yml:latest
I might do something wrong here. Can somebody help me? I much appreciate your time!
I solved the issue, finally. The issue came from the fact that I had in docker-compose.yml remaxmdcrm_remaxmd-network declared as external. The external network was not created during installation, thus I needed to create a bridging network.
I ran the command docker network create "name_of_network"
For further details, here is the full documentation this
You can see docker network ls and uses bridge network
You shouldn't have to run a command to create the network prior to running docker compose, Docker should create the network if it doesn't exist. The reason you're getting this error is because you're declaring the network as external, which means that Docker expects it to already exist. If you need a new one, remove external: true

docker-compose up doesn't map ports on centos 7

I'm trying to docker-compose an existing application. Now I struggle on centos on a basic task.
Given docker-compose.yml:
version: '3.8'
services:
nginx:
image: nginx:latest
ports:
- "1024:80"
When run with docker-compose up localhost:1024 is not accessible. When I add the started container to the default bridge network (docker network connect <id of bridge> <id of container>), localhost:1024 is accessible.
When run with docker run -p 1024:80 nginx:latest localhost:1024 is accessible.
docker-compose version 1.26.2, build eefe0d31
Docker version 19.03.12, build 48a66213fe
CentOS Linux release 7.6.1810
When attempting to docker-compose up the same file on macOS localhost:1024 is accessible.
EDIT #1
docker ps PORTS output: 0.0.0.0:1024->80/tcp
new interface added ifconfig: br-da0abb61196d
Same behavior on different ports e.g. 8080

Docker container log does not appear anymore on Docker compose log

I'm running my Docker container through my Docker compose, but when my container stops and it restarts again, the log does not appear anymore related to this restarted container.
Would anyone know how to fix it?
I send below the docker compose command and the file for analysis.
Thank you in advance.
Command to start the compose
docker-compose -f docker-compose.dev.yml up
Docker compose
version: '3'
services:
ms3_executive_back:
image: ms3_executive_backend
ports:
- "5001:5001"
volumes:
- ./executive_backend:/app
restart: always
If you want to inspect the logs to determine cause of failure, you can try setting your restart: "no". This will ensure that docker-compose does not automatically restart your container and overwrite the existing logs.

docker stack ignoring unsupported options

I am running docker Server Version: 18.06.0-ce on centos 7.5.
I have a docker-compose file running db2 server with the following sample definition:
The docker-compose file has the following options:
version: "3.7"
services:
db2exp:
image: db2
ports:
- "50000:50000"
networks:
- lmnet
ipc: host
cap_add:
- IPC_LOCK
- IPC_OWNER
environment:
- DB2INSTANCE=db2inst1
- DB2PASSWD=db2inst1
- LICENSE=accept
volumes:
- db2data:/home
When using docker-compose up, I do not have problems with starting the db2 service. However when I try to use docker stack, I get the following message:
docker stack deploy test --compose-file docker-compose.yml
Ignoring unsupported options: cap_add, ipc
This renders db2start to return SQL1042C An unexpected system error occurred.
It would be ideal if what runs in compose runs in stack. What, if any, can be done so that the db2 container can be used in a docker stack environment and not just docker-compose?
If it matters, I have docker-compose version 1.23.0-rc1, build 320e4819.
Thanks in advance.
This is not supported by swarm mode currently as the error message you've show and documentation identify. Personally I'd question whether you really want to have your database running in swarm mode. Docker does not migrate the volume for you, so you wouldn't see your data if rescheduled on another node.
You can follow the progress of getting this added to Swarm Mode in the github issues, there are several, including:
https://github.com/moby/moby/issues/24862
https://github.com/moby/moby/issues/25885
The hacky solution I've seen if you really need this run from swarm mode is to schedule a container with the docker socket mounted and docker binaries in the image, which then executes a docker run command directly against the local engine. E.g.:
version: "3.7"
services:
db2exp-wrapper:
image: docker:stable
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: docker run --rm --cap-add IPC_LOCK --cap-add IPC_OWNER -p 50000:50000 ... db2
I don't really recommend the above solution, sticking with docker-compose would likely be a better implementation for your use case. Downsides of this solution include only publishing the port on the single host, and potential security risks of anyone else with access to that docker socket.

Resources