4545
4646 You can now launch MAPDL directly from docker with a short script or
4747directly from the command line. Since this image contains no license
48- server, you must enter your license server IP address in the
48+ server, you will need to enter in your license server IP address the
4949``LICENSE_SERVER `` environment variable. With that, you can launch
5050MAPDL with:
5151
@@ -77,8 +77,7 @@ Once you've launched MAPDL you should see:
7777 Server listening on : 0.0.0.0:50052
7878
7979 Connecting to the MAPDL Container from Python
80- ---------------------------------------------
81-
80+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8281You can now connect to the instance with:
8382
8483.. code :: python
@@ -105,10 +104,6 @@ Verify your connection with:
105104
106105 Additional Considerations
107106-------------------------
108-
109- Appending MAPDL Options to the Container
110- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111-
112107In the command:
113108
114109.. code ::
@@ -126,119 +121,6 @@ with the `-np` switch. For example:
126121 IMAGE=ghcr.io/pyansys/pymapdl/mapdl:$VERSION
127122 docker run -e ANSYSLMD_LICENSE_FILE=$LICENSE_SERVER -p 50052:50052 $IMAGE -np 4
128123
129- For additional command- line arguments, see the Ansys
124+ For additional command line arguments please see the ansys
130125documentation at `ANSYS help <https://ansyshelp.ansys.com >`_. Also,
131126be sure to have the appropriate license for additional HPC features.
132-
133- Using ``--restart `` policy with MAPDL products
134- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135-
136- By default, MAPDL creates a ``LOCK `` file in the working directory when it starts
137- and deletes this file if it exits normally. The file is used to avoid overwriting files
138- such as database (DB) files or result (RST) files when starting MAPDL after an
139- abnormal termination.
140-
141- Because of this behavior, when using the Docker ``--restart `` flag in the ``docker run ``
142- command, you might enter into an infinite loop if you specify the Docker image to
143- reboot after an abnormal termination. For example, ``--restart always ``.
144- Because of the presence of the ``LOCK `` file, MAPDL exits, attempting to not overwrite
145- the files from the previous crash, while the Docker process keeps attempting to
146- restart the MAPDL container (and the MAPDL process with it).
147-
148- In such cases, you should not use the ``--restart `` option. If you really need to use
149- this option, you can avoid MAPDL checks and create the ``LOCK `` file by starting
150- the process with the environment variable ``ANSYS_LOCK `` set to ``"OFF" ``.
151-
152- You can do this in your ``docker run `` command:
153-
154- .. code :: bash
155-
156- docker run \
157- --restart always \
158- -e ANSYSLMD_LICENSE_FILE=1055@$LICENSE_SERVER \
159- -e ANSYS_LOCK=" OFF" \
160- -p 50052:50052 \
161- $IMAGE
162-
163-
164- Getting Useful Files After Abnormal Termination
165- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
166-
167- In some cases, the MAPDL container might crash after the MAPDL process experiences an
168- abnormal termination. In these cases, you can retrieve log files and output files using
169- tools that Docker provides.
170-
171- First, get the Docker container name:
172-
173- .. code :: pwsh
174-
175- PS docker ps
176- CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
177- c14560bff70f ghcr.io/ pyansys/ pymapdl/ mapdl:v22.2.0 " /ansys_inc/ansys/bi…" 9 seconds ago Up 8 seconds 0.0 .0.0 :50053 - > 50052 / tcp mapdl
178-
179- To appear in ``docker ps ``, the container should be running.
180-
181- You can then use the ``name `` in the following command:
182-
183- .. code :: pwsh
184-
185- PS docker exec - it mapdl / bin/ bash
186-
187- This command executes the command shell (``/bin/bash ``) of the container and attaches your current terminal to it (interactive ``-it ``).
188-
189- .. code :: pwsh
190-
191- PS C:\Users\user> docker exec - it mapdl / bin/ bash
192- [root @c14560bff70f / ]#
193-
194- Now you can enter commands inside the Docker container and navigate inside it.
195-
196- .. code :: pwsh
197-
198- PS C:\Users\user> docker exec - it mapdl / bin/ bash
199- [root @c14560bff70f / ]# ls
200- anaconda- post.log cleanup- ansys- c14560bff70f- 709. sh file0.err file1.err file1.page file2.out file3.log home media proc sbin tmp
201- ansys_inc dev file0.log file1.log file2.err file2.page file3.out lib mnt root srv usr
202- bin etc file0.page file1.out file2.log file3.err file3.page lib64 opt run sys var
203-
204- You can then take note of the files you want to retrieve. For example, the error and output files (``file*.err `` and ``file*.out ``).
205-
206- Exit the container terminal using ``exit ``:
207-
208- .. code :: pwsh
209-
210- [root @c14560bff70f / ]# exit
211- exit
212- (base) PS C:\Users\user>
213-
214- You can copy the noted files using this script:
215-
216- .. code :: pwsh
217-
218- docker cp mapdl:/ file0.err .
219- docker cp mapdl:/ file1.err .
220- docker cp mapdl:/ file1.out .
221-
222- If you want to retrieve multiple files, the most efficient approach is to get back inside the Docker container:
223-
224- .. code :: pwsh
225-
226- PS C:\Users\user> docker exec - it mapdl / bin/ bash
227- [root @c14560bff70f / ]#
228-
229- Create a folder where you are going to copy all the desired files:
230-
231- .. code :: pwsh
232-
233- [root @c14560bff70f / ]# mkdir -p /mapdl_logs
234- [root @c14560bff70f / ]# cp -f /file*.out /mapdl_logs
235- [root @c14560bff70f / ]# cp -f /file*.err /mapdl_logs
236- [root @c14560bff70f / ]# ls mapdl_logs/
237- file0.err file1.err file1.out file2.err file2.out file3.err file3.out
238-
239- Then copy the entire folder content at once:
240-
241- .. code :: pwsh
242-
243- docker cp mapdl:/ mapdl_logs/ . .
244-
0 commit comments